From: John Darrington Date: Wed, 4 Jul 2018 11:12:25 +0000 (+0200) Subject: Fix crash when attempting to add a new variable in the middle of the dictionary. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca1382f24fd0a8a90dd65daf98a279d6a549d9da;p=pspp Fix crash when attempting to add a new variable in the middle of the dictionary. Fixes bug #52551. * src/ui/gui/psppire-variable-sheet.c (change_var_property): Don't attempt to alter a variable property if it's index is more than one below the last index. --- diff --git a/src/ui/gui/psppire-variable-sheet.c b/src/ui/gui/psppire-variable-sheet.c index 35ee7d6085..32d163f665 100644 --- a/src/ui/gui/psppire-variable-sheet.c +++ b/src/ui/gui/psppire-variable-sheet.c @@ -305,6 +305,10 @@ change_var_property (PsppireVariableSheet *var_sheet, gint col, gint row, const PsppireDict *dict = NULL; g_object_get (var_sheet, "data-model", &dict, NULL); + int n_rows = psppire_dict_get_var_cnt (dict); + if (row > n_rows) + return; + /* Return the IDXth variable */ struct variable *var = psppire_dict_get_variable (dict, row);