Added an error if an image cannot be loaded instead of letting gdk-pixbuf error.

This commit is contained in:
Scoopta 2020-03-17 14:21:10 -07:00
parent 50719af3dd
commit 0b5ad3499d

View File

@ -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;