From a2d2f76bd03df51b099a3f0e915369d22089ae5c Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Tue, 9 Oct 2012 01:19:15 +0200 Subject: [PATCH] Fixed possible null pointer dereference The new function 'unpaint_app_icon' checks its argument 'wapp' aginst NULL, however it does dereference the pointer beforehand, which will end up in a crash if the null-pointer case occurs. --- src/appicon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/appicon.c b/src/appicon.c index f2dc9575..9bac0ef6 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -160,8 +160,8 @@ void makeAppIconFor(WApplication *wapp) void unpaint_app_icon(WApplication *wapp) { WAppIcon *aicon; - WScreen *scr = wapp->main_window_desc->screen_ptr; - WDock *clip = scr->workspaces[scr->current_workspace]->clip; + WScreen *scr; + WDock *clip; if (!wapp || !wapp->app_icon) return; @@ -172,6 +172,9 @@ void unpaint_app_icon(WApplication *wapp) if (aicon->docked) return; + scr = wapp->main_window_desc->screen_ptr; + clip = scr->workspaces[scr->current_workspace]->clip; + if (!clip || !aicon->attracted || !clip->collapsed) XUnmapWindow(dpy, aicon->icon->core->window); -- 2.11.4.GIT