...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
view->impl->has_strut_partial(view);
}
+/* Note: It is safe to assume that this function never returns NULL */
const char *
view_get_string_prop(struct view *view, const char *prop)
{
assert(view);
assert(prop);
if (view->impl->get_string_prop) {
- return view->impl->get_string_prop(view, prop);
+ const char *ret = view->impl->get_string_prop(view, prop);
+ return ret ? ret : "";
}
return "";
}
}
if (!strcmp(prop, "title")) {
- return xdg_toplevel->title;
+ return xdg_toplevel->title ? xdg_toplevel->title : "";
}
if (!strcmp(prop, "app_id")) {
- return xdg_toplevel->app_id;
+ return xdg_toplevel->app_id ? xdg_toplevel->app_id : "";
}
return "";
}
}
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
* 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 "";
}