summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2021-10-20 08:59:47 +0200
committerbakkeby <[email protected]>2021-10-20 08:59:47 +0200
commit84355a6d90bd7f5faffb7dec54071beae97a9017 (patch)
treeefb84f53d1e10bae1588b5c3e11dc4912a94d2dd /patch
parentce270a320e1a5ca1eeda858d475b9d85784f3f42 (diff)
downloaddwm-flexipatch-84355a6d90bd7f5faffb7dec54071beae97a9017.tar.gz
dwm-flexipatch-84355a6d90bd7f5faffb7dec54071beae97a9017.zip
fodcusadjacenttag: Add selmon->sel guards for tagandviewtoleft/right to prevent segmentation faults ref. #191
Diffstat (limited to 'patch')
-rw-r--r--patch/focusadjacenttag.c6
1 files changed, 4 insertions, 2 deletions
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 */