mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
WINGs: do not crash on NULL title in WMSetWindowTitle (Coverity #50046)
As pointed by Coverity, despite apparent checks the function would fail if trying to set a NULL title. Instead of trying to do over-complicated things we just ignore (with a warning if NDEBUG is not set) the case. If user wants an empty title, the correct way is to provide "" as we're not able to remove a title. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
24e223dc27
commit
c86de122f9
@@ -255,12 +255,12 @@ static void setMiniwindow(WMWindow *win, RImage *image)
|
||||
|
||||
void WMSetWindowTitle(WMWindow * win, const char *title)
|
||||
{
|
||||
wassertr(title != NULL);
|
||||
|
||||
if (win->title != NULL)
|
||||
wfree(win->title);
|
||||
if (title != NULL)
|
||||
win->title = wstrdup(title);
|
||||
else
|
||||
win->title = NULL;
|
||||
|
||||
win->title = wstrdup(title);
|
||||
|
||||
if (win->view->flags.realized) {
|
||||
setWindowTitle(win, title);
|
||||
|
||||
Reference in New Issue
Block a user