(same patch as in Kix's BTS)
From 109d91a4f89f6dce84642c6faf4463005b9c2820 Mon Sep 17 00:00:00 2001
From: Christophe CURIS <[email protected]>
Date: Tue, 9 Oct 2012 01:19:15 +0200
Subject: [PATCH] [Bug #0000003] 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 f2dc957..9bac0ef 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);
--
1.7.10.4