diff --git a/patch/focusadjacenttag.c b/patch/focusadjacenttag.c index 1665c18..85d9d74 100644 --- a/patch/focusadjacenttag.c +++ b/patch/focusadjacenttag.c @@ -63,7 +63,8 @@ viewtoright(const Arg *arg) void tagandviewtoleft(const Arg *arg) { - if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && selmon->tagset[selmon->seltags] > 1) { selmon->sel->tags >>= 1; selmon->seltags ^= 1; /* toggle sel tagset */ @@ -83,7 +84,8 @@ tagandviewtoleft(const Arg *arg) void tagandviewtoright(const Arg *arg) { - if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { selmon->sel->tags <<= 1; selmon->seltags ^= 1; /* toggle sel tagset */