From a2cb317f1142a737883659acaee9d0a87e7bb247 Mon Sep 17 00:00:00 2001 From: Nicolas Bonifas Date: Sun, 6 Dec 2009 02:19:20 +0100 Subject: [PATCH] Remove useless NULL test If menu is NULL we would have a null pointer dereference when initializing scr. > Ie, why not move the assignment of 'src' to after the test? I thought about this, but I checked the 3 different calls to updateWorkspaceMenu (all in winmenu.c). They must all call updateWorkspaceMenu with non-NULL pointers, so if we have a NULL 'menu' pointer then we obviously have a major problem and it is probably better to crash here than to silently return and fail a little latter. [crmafra: edit changelog] --- src/winmenu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/winmenu.c b/src/winmenu.c index 36db40f1..45d3593e 100644 --- a/src/winmenu.c +++ b/src/winmenu.c @@ -215,9 +215,6 @@ static void updateWorkspaceMenu(WMenu * menu) char title[MAX_WORKSPACENAME_WIDTH + 1]; int i; - if (!menu) - return; - for (i = 0; i < scr->workspace_count; i++) { if (i < menu->entry_no) { if (strcmp(menu->entries[i]->text, scr->workspaces[i]->name) != 0) { -- 2.11.4.GIT