Merge pull request #66 from mokulus/stack-fix

Fix crashes when stack is empty
This commit is contained in:
Luke Smith 2020-05-12 11:31:28 -04:00 committed by GitHub
commit ed5803de18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

4
dwm.c
View file

@ -990,7 +990,7 @@ focusstack(const Arg *arg)
int i = stackpos(arg);
Client *c, *p;
if (i < 0 || selmon->sel->isfullscreen)
if (i < 0 || !selmon->sel || selmon->sel->isfullscreen)
return;
for(p = NULL, c = selmon->clients; c && (i || !ISVISIBLE(c));
@ -1404,7 +1404,7 @@ pushstack(const Arg *arg) {
int i = stackpos(arg);
Client *sel = selmon->sel, *c, *p;
if(i < 0)
if(i < 0 || !sel)
return;
else if(i == 0) {
detach(sel);