From: Christophe CURIS Date: Mon, 8 Oct 2012 23:19:15 +0000 (+0200) Subject: Fixed possible null pointer dereference X-Git-Tag: wmaker-0.95.4~103 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/a2d2f76bd03df51b099a3f0e915369d22089ae5c 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. --- 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);