From d1ace58cebe40d44f0d254516b53b5c011627a74 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 2 May 2017 22:18:43 +0200 Subject: [PATCH] Image loading fallback --- radiant/gtkmisc.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index f8f5262a..26fb2c2a 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -660,15 +660,16 @@ GtkWidget* new_image_icon( const char* filename ) { str += filename; pixbuf = gdk_pixbuf_new_from_file( str.GetBuffer(), &gerror ); - if( pixbuf == NULL ) { + if( pixbuf != NULL ) { + icon = gtk_image_new_from_pixbuf( pixbuf ); + g_object_unref( pixbuf ); + } else { Sys_FPrintf( SYS_ERR, "ERROR: Failed to load bitmap: %s, %s\n", str.GetBuffer(), gerror->message ); g_error_free( gerror ); + icon = gtk_image_new_from_file( filename ); } - icon = gtk_image_new_from_pixbuf( pixbuf ); gtk_widget_show( icon ); - if( pixbuf ) { - g_object_unref( pixbuf ); - } + return icon; }