From: Christophe CURIS <[email protected]>

As pointed by Coverity, despite the numerous null pointer checks there is
still a case where one can pass trough and make wmaker crash.

This patch simplifies it all but making only one check at the beginning so
the code is safe and the remaining is simpler.

Signed-off-by: Christophe CURIS <[email protected]>
---
 src/framewin.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/framewin.c b/src/framewin.c
index 13fe1e0..d045f63 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -1205,12 +1205,12 @@ void wFrameWindowResize(WFrameWindow * fwin, int width, 
int height)
 
 int wFrameWindowChangeTitle(WFrameWindow *fwin, const char *new_title)
 {
+       if (new_title == NULL)
+               return 0;
+
        /* check if the title is the same as before */
        if (fwin->title) {
-               if (new_title && (strcmp(fwin->title, new_title) == 0))
-                       return 0;
-       } else {
-               if (!new_title)
+               if (strcmp(fwin->title, new_title) == 0)
                        return 0;
        }
 
-- 
2.1.1


-- 
To unsubscribe, send mail to [email protected].

Reply via email to