From 40c169c1409b0f16e6ee8f0ceaa0ce6937c90a5c Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 22 Sep 2017 13:55:43 +0200 Subject: [PATCH] PsppireDataStore (myreversefunc): Insert variables if attempting to access variable beyond the last --- src/ui/gui/psppire-data-store.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index d0322204e4..04b6da0858 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -136,6 +136,15 @@ myreversefunc (GtkTreeModel *model, gint col, gint row, { PsppireDataStore *store = PSPPIRE_DATA_STORE (model); + while (col >= psppire_dict_get_var_cnt (store->dict)) + { + const struct variable *var = + psppire_dict_insert_variable (store->dict, + psppire_dict_get_var_cnt (store->dict), + NULL); + g_return_val_if_fail (var, FALSE); + } + const struct variable *variable = psppire_dict_get_variable (store->dict, col); g_return_val_if_fail (variable, FALSE); -- 2.30.2