From 0b5ad3499d9c93ea58fd7eb298f77a870fa89603 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Tue, 17 Mar 2020 14:21:10 -0700 Subject: [PATCH] Added an error if an image cannot be loaded instead of letting gdk-pixbuf error. --- src/wofi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wofi.c b/src/wofi.c index 40547f8..61b90fc 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -261,6 +261,10 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi } else { if(strcmp(mode, "img") == 0 && create_widgets) { GdkPixbuf* buf = gdk_pixbuf_new_from_file(str, NULL); + if(buf == NULL) { + fprintf(stderr, "Image %s cannot be loaded\n", str); + goto done; + } int width = gdk_pixbuf_get_width(buf); int height = gdk_pixbuf_get_height(buf); if(height > width) { @@ -294,6 +298,7 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi free(tmp); } } + done: mode = NULL; if(wl_list_empty(&modes)) { break;