From: Reginald Kennedy Date: Thu, 18 Jul 2013 04:04:05 +0000 (+0800) Subject: Fix crash in rg_n/mvrg_n when the target region does not exist. X-Git-Url: https://jasonwoof.com/gitweb/?p=spectrwm.git;a=commitdiff_plain;h=bc6ee31c0fb608fa2c091a4a332934f3c66fa2df Fix crash in rg_n/mvrg_n when the target region does not exist. --- diff --git a/spectrwm.c b/spectrwm.c index 629f699..4aff709 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -3659,7 +3659,7 @@ focusrg(struct swm_region *r, union arg *args) DNPRINTF(SWM_D_FOCUS, "focusrg: id: %d\n", ridx); rr = TAILQ_FIRST(&r->s->rl); - for (i = 0; i < ridx; ++i) + for (i = 0; i < ridx && rr != NULL; ++i) rr = TAILQ_NEXT(rr, entry); if (rr == NULL) @@ -4671,7 +4671,7 @@ send_to_rg(struct swm_region *r, union arg *args) DNPRINTF(SWM_D_FOCUS, "send_to_rg: id: %d\n", ridx); rr = TAILQ_FIRST(&r->s->rl); - for (i = 0; i < ridx; ++i) + for (i = 0; i < ridx && rr != NULL; ++i) rr = TAILQ_NEXT(rr, entry); if (rr == NULL)