From: John Darrington Date: Sat, 2 Mar 2019 14:29:39 +0000 (+0100) Subject: PSPPIRE: Avoid some segmentation faults when corrupt data is encountered. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0;p=pspp PSPPIRE: Avoid some segmentation faults when corrupt data is encountered. --- diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index f97b8eaf1c..3c2765f5dd 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));