JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Fix crash in rg_n/mvrg_n when the target region does not exist.
authorReginald Kennedy <rk@rejii.com>
Thu, 18 Jul 2013 04:04:05 +0000 (12:04 +0800)
committerReginald Kennedy <rk@rejii.com>
Thu, 18 Jul 2013 04:13:31 +0000 (12:13 +0800)
spectrwm.c

index 629f699..4aff709 100644 (file)
@@ -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)