Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0 From df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 2 Mar 2019 15:29:39 +0100 Subject: PSPPIRE: Avoid some segmentation faults when corrupt data is encountered. --- src/ui/gui/psppire-data-store.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index f97b8eaf1..3c2765f5d 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -183,6 +183,8 @@ psppire_data_store_value_to_string (gpointer unused, PsppireDataStore *store, gi g_return_val_if_fail (variable, g_strdup ("???")); GVariant *vrnt = g_value_get_variant (v); + g_return_val_if_fail (vrnt, g_strdup ("???")); + union value val; value_variant_get (&val, vrnt); @@ -231,12 +233,14 @@ __get_value (GtkTreeModel *tree_model, if (NULL == variable) return; - g_value_init (value, G_TYPE_VARIANT); - gint row = GPOINTER_TO_INT (iter->user_data); struct ccase *cc = datasheet_get_row (store->datasheet, row); + g_return_if_fail (cc); + + g_value_init (value, G_TYPE_VARIANT); + const union value *val = case_data_idx (cc, var_get_case_index (variable)); GVariant *vv = value_variant_new (val, var_get_width (variable)); -- cgit v1.2.1