1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
From: Tasos Sahanidis <tasos@tasossah.com>
Date: Sat, 21 Jan 2023 16:44:35 +0200
Subject: Fix assert fail when no vorbis players are available
Origin: commit:6a11003099660dfae0e3d5800f49880d3a26f5ec
Applied-Upstream: yes
---
src/alarm-applet.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/alarm-applet.c b/src/alarm-applet.c
index 354acb7..647b300 100644
--- a/src/alarm-applet.c
+++ b/src/alarm-applet.c
@@ -308,23 +308,31 @@ void alarm_applet_apps_load(AlarmApplet* applet)
// Get all supported apps
GList* app_list = g_app_info_get_recommended_for_type(app_list_content_type);
+ if(!app_list) {
+ g_debug("Could not find any recommended applications for %s", app_list_content_type);
+ return;
+ }
// Get default app
GAppInfo* default_audio_app = g_app_info_get_default_for_type(app_list_content_type, FALSE);
- g_debug("Default vorbis player: %p %s %s", default_audio_app, g_app_info_get_display_name(default_audio_app), g_app_info_get_executable(default_audio_app));
+ if(default_audio_app) {
+ g_debug("Default vorbis player: %p %s %s", default_audio_app, g_app_info_get_display_name(default_audio_app), g_app_info_get_executable(default_audio_app));
- // Move default app to the top
- // First, find it in the list
- GList* default_audio_app_item = g_list_find_custom(app_list, default_audio_app, (GCompareFunc)g_app_info_same_executable);
- g_assert(default_audio_app_item != NULL);
+ // Move default app to the top
+ // First, find it in the list
+ GList* default_audio_app_item = g_list_find_custom(app_list, default_audio_app, (GCompareFunc)g_app_info_same_executable);
+ g_assert(default_audio_app_item != NULL);
- g_object_unref(g_steal_pointer(&default_audio_app));
+ g_object_unref(g_steal_pointer(&default_audio_app));
- // Remove it
- app_list = g_list_remove_link(app_list, default_audio_app_item);
+ // Remove it
+ app_list = g_list_remove_link(app_list, default_audio_app_item);
- // Then, prepend it
- app_list = g_list_concat(default_audio_app_item, app_list);
+ // Then, prepend it
+ app_list = g_list_concat(default_audio_app_item, app_list);
+ } else {
+ g_debug("Could not get default application for %s", app_list_content_type);
+ }
// Finally, remove any unknown apps
for(GList* l = app_list; l;) {
|