From 0a078ce21e1ec4c5913fd0dd63e64452dc736c4a Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 4 May 2024 20:55:22 +0200 Subject: [PATCH] fix: do not segfault on selmon NULL --- dwl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index c117adeed4db78f3c6b60b1b79e59704a318eee0..e38da83465acef90ded219c2c81693a91cafba82 100644 --- a/dwl.c +++ b/dwl.c @@ -2911,11 +2911,13 @@ void view(const Arg *arg) { Monitor *m, *origm = selmon; - unsigned int newtags = selmon->tagset[selmon->seltags ^ 1]; + unsigned int newtags; if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; + newtags = selmon->tagset[selmon->seltags ^ 1]; + /* swap tags when trying to display a tag from another monitor */ if (arg->ui & TAGMASK) newtags = arg->ui & TAGMASK;