mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: fix NULL string_prop crash
...when app_id is NULL. Make sure view_get_string_prop() never returns NULL because it is so easy to misuse. Same for the respective xwayland/xdg impl methods in case anyone decides to (incorrectly) call them directly in future. Fixes: #2453
This commit is contained in:
parent
bad788ccdd
commit
023427b4f4
3 changed files with 8 additions and 6 deletions
|
|
@ -485,10 +485,10 @@ xwayland_view_get_string_prop(struct view *view, const char *prop)
|
|||
}
|
||||
|
||||
if (!strcmp(prop, "title")) {
|
||||
return xwayland_surface->title;
|
||||
return xwayland_surface->title ? xwayland_surface->title : "";
|
||||
}
|
||||
if (!strcmp(prop, "class")) {
|
||||
return xwayland_surface->class;
|
||||
return xwayland_surface->class ? xwayland_surface->class : "";
|
||||
}
|
||||
/*
|
||||
* Use the WM_CLASS 'instance' (1st string) for the app_id. Per
|
||||
|
|
@ -500,7 +500,7 @@ xwayland_view_get_string_prop(struct view *view, const char *prop)
|
|||
* here since we use the app_id for icon lookups.
|
||||
*/
|
||||
if (!strcmp(prop, "app_id")) {
|
||||
return xwayland_surface->instance;
|
||||
return xwayland_surface->instance ? xwayland_surface->instance : "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue