summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-18 07:17:55 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-18 07:17:55 -0400
commitfc250493ca7a4397ec0908c3c93e519c165a3141 (patch)
tree88260f52dccc9f32c7e2daf3b6d03fc4539c46c3 /gtk-gui.c
parentac06d1f693f8dfb9fb1a4616028118bfe9a48a88 (diff)
downloadsubsurface-fc250493ca7a4397ec0908c3c93e519c165a3141.tar.gz
Fix crash when simply clicking OK in import dialog
Since the GSList is now only created if the user enters the file selection dialog, opening the import dialog and then clicking OK without selecting either a dive computer or a file would cause a crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 25fc55569..58ae80ac7 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1395,7 +1395,7 @@ void import_dialog(GtkWidget *w, gpointer data)
{
int result;
GtkWidget *dialog, *hbox, *vbox, *label, *info = NULL;
- GSList *filenames;
+ GSList *filenames = NULL;
GtkComboBox *computer;
GtkEntry *device;
device_data_t devicedata = {
@@ -1433,7 +1433,7 @@ repeat:
* we ignore whether a dive computer model was picked */
if (info)
gtk_widget_destroy(info);
- if (g_slist_length(filenames) == 0) {
+ if (!filenames || g_slist_length(filenames) == 0) {
const char *vendor, *product;
if (!gtk_combo_box_get_active_iter(computer, &iter))
@@ -1455,7 +1455,7 @@ repeat:
info = import_dive_computer(&devicedata, GTK_DIALOG(dialog));
if (info)
goto repeat;
- } else {
+ } else if (filenames) {
g_slist_foreach(filenames,do_import_file,NULL);
g_slist_free(filenames);
}