From 4a75ef1461b812818838247a95604ed0ab9696bf Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 13 Feb 2008 03:22:02 +0000 Subject: [PATCH 1/1] Fixed crash when trying to get the label of a non-existant variable. --- src/ui/gui/ChangeLog | 3 +++ src/ui/gui/compute-dialog.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) 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); } -- 2.30.2