summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquartenium <quartenium@gmail.com>2017-09-11 17:59:11 +0300
committerArx Cruz <arxcruz@redhat.com>2019-04-14 18:09:34 +0000
commitcd636315a5ff60567ff6a49ea10f326b69337029 (patch)
tree9d4d0c4c395e6b5f98be31f9135cf12e6a1f8c0d
parentUpdated Danish translation (diff)
downloadzenity-cd636315a5ff60567ff6a49ea10f326b69337029.tar.gz
zenity-cd636315a5ff60567ff6a49ea10f326b69337029.tar.bz2
zenity-cd636315a5ff60567ff6a49ea10f326b69337029.zip
src/forms.c: Fix segfault on multiple lists without values
If was not provided enought list-values for add-list options then column_types is NULL. Therefore need set it to default value. If count of columns values less than count of list values then set column nubmer to zero.
-rw-r--r--src/forms.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/forms.c b/src/forms.c
index 4e6fca5d..15df7189 100644
--- a/src/forms.c
+++ b/src/forms.c
@@ -110,8 +110,15 @@ zenity_forms_create_and_fill_list (
tree_view = gtk_tree_view_new ();
if (forms_data->column_values) {
+ int columns_values_count =
+ g_slist_length (forms_data->column_values);
+ int column_number = 0;
+ if (list_number < columns_values_count) {
+ column_number = list_number;
+ }
+
column_values =
- g_slist_nth_data (forms_data->column_values, list_number);
+ g_slist_nth_data (forms_data->column_values, column_number);
if (column_values) {
gchar **values = g_strsplit_set (column_values, "|", -1);
if (values) {
@@ -130,6 +137,10 @@ zenity_forms_create_and_fill_list (
column_index++;
}
}
+ } else {
+ /* If no values available, add one with string type*/
+ column_types = g_new (GType, n_columns);
+ column_types[0] = G_TYPE_STRING;
}
}
bgstack15