From df0fdce92b34406262ee522ad3910cefcc6ffd9e Mon Sep 17 00:00:00 2001 From: "Victor \"multun\" Collod" Date: Wed, 11 Jan 2023 23:02:09 +0100 Subject: [PATCH] get_desktop_app_info: fix crash on failed DesktopAppInfo::create Even though it makes little sense for this call to fail, it sometimes randomly does, and takes down waybar with it. --- src/modules/wlr/taskbar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 97d84bd..5460244 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -102,8 +102,11 @@ Glib::RefPtr get_desktop_app_info(const std::string &app_id desktop_file = desktop_list[0][i]; } else { auto tmp_info = Gio::DesktopAppInfo::create(desktop_list[0][i]); - auto startup_class = tmp_info->get_startup_wm_class(); + if (!tmp_info) + // see https://github.com/Alexays/Waybar/issues/1446 + continue; + auto startup_class = tmp_info->get_startup_wm_class(); if (startup_class == app_id) { desktop_file = desktop_list[0][i]; break;