From: John Darrington Date: Fri, 7 Apr 2017 07:18:02 +0000 (+0200) Subject: Don't update the cell entry ref if there is no active cell X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bd42422aa6315d0a23c4a187da0266dd287cc86;p=pspp Don't update the cell entry ref if there is no active cell --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 52493821d7..eb2e8eb4f9 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -498,21 +498,22 @@ on_data_sheet_var_double_clicked (JmdSheet *data_sheet, gint dict_index, static void refresh_entry (PsppireDataEditor *de) { - union value val; gint row, col; - jmd_sheet_get_active_cell (JMD_SHEET (de->data_sheet), &col, &row); - - const struct variable *var = psppire_dict_get_variable (de->dict, col); - psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (de->datum_entry), var); - - int width = var_get_width (var); - if (! psppire_data_store_get_value (PSPPIRE_DATA_STORE (de->data_store), - row, var, &val)) - return; - - psppire_value_entry_set_value (PSPPIRE_VALUE_ENTRY (de->datum_entry), - &val, width); - value_destroy (&val, width); + if (jmd_sheet_get_active_cell (JMD_SHEET (de->data_sheet), &col, &row)) + { + union value val; + const struct variable *var = psppire_dict_get_variable (de->dict, col); + psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (de->datum_entry), var); + + int width = var_get_width (var); + if (! psppire_data_store_get_value (PSPPIRE_DATA_STORE (de->data_store), + row, var, &val)) + return; + + psppire_value_entry_set_value (PSPPIRE_VALUE_ENTRY (de->datum_entry), + &val, width); + value_destroy (&val, width); + } } static void