]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd-thumbnail: make sure item->{normal,active}_title are non-null
authortokyo4j <hrak1529@gmail.com>
Sun, 12 Oct 2025 14:59:04 +0000 (23:59 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Mon, 13 Oct 2025 17:27:13 +0000 (02:27 +0900)
The if-statement doesn't make sense, because `view_get_string_prop()`
never returns NULL. And if it did, it would cause segfault in
`osd_thumbnail_update()`.

src/osd/osd-thumbnail.c

index 24505a31aa5d8638f9ca14ee9e087ebcb4196d76..d17f6fc3b91ce05af99f3fbe72fe78c2fce73080 100644 (file)
@@ -156,14 +156,12 @@ create_item_scene(struct wlr_scene_tree *parent, struct view *view,
 
        /* title */
        const char *title = view_get_string_prop(view, "title");
-       if (title) {
-               item->normal_title = create_title(item->tree, switcher_theme,
-                       title, theme->osd_label_text_color,
-                       theme->osd_bg_color, title_y);
-               item->active_title = create_title(item->tree, switcher_theme,
-                       title, theme->osd_label_text_color,
-                       switcher_theme->item_active_bg_color, title_y);
-       }
+       item->normal_title = create_title(item->tree, switcher_theme,
+               title, theme->osd_label_text_color,
+               theme->osd_bg_color, title_y);
+       item->active_title = create_title(item->tree, switcher_theme,
+               title, theme->osd_label_text_color,
+               switcher_theme->item_active_bg_color, title_y);
 
        /* icon */
        int icon_size = switcher_theme->item_icon_size;