mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58: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)
|
void WMSetWindowTitle(WMWindow * win, const char *title)
|
||||||
{
|
{
|
||||||
|
wassertr(title != NULL);
|
||||||
|
|
||||||
if (win->title != NULL)
|
if (win->title != NULL)
|
||||||
wfree(win->title);
|
wfree(win->title);
|
||||||
if (title != NULL)
|
|
||||||
win->title = wstrdup(title);
|
win->title = wstrdup(title);
|
||||||
else
|
|
||||||
win->title = NULL;
|
|
||||||
|
|
||||||
if (win->view->flags.realized) {
|
if (win->view->flags.realized) {
|
||||||
setWindowTitle(win, title);
|
setWindowTitle(win, title);
|
||||||
|
|||||||
Reference in New Issue
Block a user