movecenter: fix the crash when no window is selected

This commit is contained in:
GasparVardanyan 2024-09-02 01:01:12 +04:00
parent 565bf30529
commit 9277e38b0a

8
dwm.c
View file

@ -1206,9 +1206,11 @@ movemouse(const Arg *arg)
void
movecenter(const Arg *arg)
{
selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
arrange(selmon);
if (selmon->sel) {
selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
arrange(selmon);
}
}
Client *