From: H.G.Muller Date: Wed, 20 Apr 2016 21:56:31 +0000 (+0200) Subject: Make preview resistent to nothing being selected X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=e13fd4c370773a8f4ddb364f7102caceb1513ea7;p=xboard.git 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. --- 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; }