psppire-import: fixed bug with short csv file import
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Fri, 26 Jun 2020 16:04:17 +0000 (18:04 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Fri, 26 Jun 2020 16:04:17 +0000 (18:04 +0200)
The import crashed with a short csv file.
Closes: https://savannah.gnu.org/bugs/?58644
src/ui/gui/psppire-import-assistant.c

index 88074bc7b7d5e6625ab5aac75235eeaa8382fe1d..635941c2d25d55e72be412e4d9c0fad835fe5e6f 100644 (file)
@@ -301,7 +301,8 @@ choose_likely_separators (PsppireImportAssistant *ia)
       hmap_destroy (&count_map[j]);
     }
 
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (get_widget_assert (ia->builder, separators[most_frequent].name)), TRUE);
+  const char* sepname = separators[MAX (0,most_frequent)].name;
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (get_widget_assert (ia->builder, sepname)), TRUE);
 }
 
 static void