From e13fd4c370773a8f4ddb364f7102caceb1513ea7 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 20 Apr 2016 23:56:31 +0200 Subject: [PATCH] Make preview resistent to nothing being selected The name of the selected file could be a null pointer, and ScaleOnePiece does not like that for a pieceImageDirectory. --- gtk/xoptions.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gtk/xoptions.c b/gtk/xoptions.c index a12a050..f64a2d5 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -1110,9 +1110,11 @@ BrowseCallback (GtkFileChooser *chooser, gpointer data) char *name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); Option *opt = currentOption + (int)(intptr_t) data; int n = (int) (intptr_t) opt->choice; - Preview(n, name); - messedUp = TRUE; - if(name) g_free(name); + if(name) { + Preview(n, name); + messedUp = TRUE; + g_free(name); + } return FALSE; } -- 1.7.0.4