swap assertions for if checks

This commit is contained in:
Akos Horvath 2023-07-05 20:36:08 +02:00
parent f98f9e6826
commit 72663656e4

View File

@ -168,9 +168,9 @@ void wm_client_focus(Wm *wm, Client *c)
Client *old_focused_client = wm->focused_client;
if (!old_focused_client)
old_focused_client = wm_client_get_focused(wm);
assert(old_focused_client);
old_focused_client->focused = false;
if (old_focused_client)
old_focused_client->focused = false;
XSetInputFocus(wm->display, c->window, RevertToPointerRoot, CurrentTime);
wm_client_set_atom(wm, c, "_NET_ACTIVE_WINDOW", (unsigned char*) &c->window,
@ -376,7 +376,9 @@ Client* wm_client_get_focused(Wm *wm)
Workspace *ws = &wm->smon->workspaces[wm->smon->selws];
TreeNode *node = wm_treenode_ptr_find_focused_client_node(&ws->tree);
assert(node);
if (!node)
return NULL;
return node->client;
}