Fail more gracefully when selecting cells out of range
[pspp] / src / ui / gui / psppire-data-store.c
index 74677259f72ed65d0ab03744f810681ab82cac7f..27f5502d3be6ad71e94d109e6b6da40b48bc07a1 100644 (file)
@@ -139,6 +139,8 @@ __get_value (GtkTreeModel *tree_model,
   PsppireDataStore *store  = PSPPIRE_DATA_STORE (tree_model);
 
   const struct variable *variable = psppire_dict_get_variable (store->dict, column);
+  if (NULL == variable)
+    return;
 
   if (var_is_numeric (variable))
     g_value_init (value, G_TYPE_DOUBLE);
@@ -168,6 +170,9 @@ __get_type (GtkTreeModel *tree_model,   gint idx)
 
   const struct variable *variable = psppire_dict_get_variable (store->dict, idx);
 
+  if (NULL == variable)
+    return 0;
+
   if (var_is_numeric (variable))
     return G_TYPE_DOUBLE;