From 1b00071c266a7beba53be7b7f2e8c808e5bdb8a8 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 29 Nov 2014 16:35:19 +0100 Subject: [PATCH] wmaker: add check for null pointer in wAppIconCreateForDock (Coverity #50053) As pointed by Coverity, there is in the same procedure a check for null pointer before use, and later a direct use without check. In most case, the pointer is not null, but it one case it is hard to be sure that the pointer cannot be null, so it's safer to just add a check there also. Took opportunity to swap the order of the arguments in the if, because if the config flag is false it is not necessary to spend time on doing the more expensive strcmp. Signed-off-by: Christophe CURIS --- src/appicon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appicon.c b/src/appicon.c index 1d28a245..ed03ffc1 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -126,7 +126,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *w if (wm_instance) aicon->wm_instance = wstrdup(wm_instance); - if (strcmp(wm_class, "WMDock") == 0 && wPreferences.flags.clip_merged_in_dock) + if (wPreferences.flags.clip_merged_in_dock && wm_class != NULL && strcmp(wm_class, "WMDock") == 0) tile = TILE_CLIP; aicon->icon = icon_create_for_dock(scr, command, wm_instance, wm_class, tile); -- 2.11.4.GIT