From: John Darrington Date: Wed, 13 Feb 2008 03:22:02 +0000 (+0000) Subject: Fixed crash when trying to get the label of a non-existant variable. X-Git-Tag: v0.6.0~116 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a75ef1461b812818838247a95604ed0ab9696bf;p=pspp-builds.git Fixed crash when trying to get the label of a non-existant variable. --- diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 06d3fd54..845a2eef 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -4,6 +4,9 @@ variable selected. Add a valid predicate so that this can't happen anyway. + * compute-dialog.c: Fix crash when trying to set label on non + existant variable. + 2008-02-09 Ben Pfaff Consolidate multiple messages into single message dialog. Patch diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c index 3e8677ba..9eafc2c2 100644 --- a/src/ui/gui/compute-dialog.c +++ b/src/ui/gui/compute-dialog.c @@ -325,10 +325,15 @@ on_expression_toggle (GtkToggleButton *button, gpointer data) (GTK_ENTRY (get_widget_assert (cd->xml, "compute-entry1"))); target_var = psppire_dict_lookup_var (cd->dict, target_name); - label = var_get_label (target_var); + if ( target_var ) + { + label = var_get_label (target_var); - if ( label ) - gtk_entry_set_text (GTK_ENTRY (entry), label); + if ( label ) + gtk_entry_set_text (GTK_ENTRY (entry), label); + } + else + gtk_entry_set_text (GTK_ENTRY (entry), ""); gtk_widget_set_sensitive (entry, TRUE); }