PsppireDataStore (myreversefunc): Insert variables if attempting to access variable...
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 22 Sep 2017 11:55:43 +0000 (13:55 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 22 Sep 2017 11:57:29 +0000 (13:57 +0200)
src/ui/gui/psppire-data-store.c

index d0322204e413da1bb97de98c48203c6d1d76ad59..04b6da0858ea3d1336d75674b1b00bd6b4d21ac7 100644 (file)
@@ -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);