Fixed crash when trying to get the label of a non-existant variable.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 13 Feb 2008 03:22:02 +0000 (03:22 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 13 Feb 2008 03:22:02 +0000 (03:22 +0000)
src/ui/gui/ChangeLog
src/ui/gui/compute-dialog.c

index 06d3fd5461c8205e303209860a6e5efd2dbf8ae2..845a2eef0f30f7ac74bcce2206f5a90b4d072d1f 100644 (file)
@@ -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  <blp@gnu.org>
 
        Consolidate multiple messages into single message dialog.  Patch
index 3e8677ba48fd95863555e9bb84de59ef30b7146f..9eafc2c2b84e3be47dab73660a088fbc9c4e17e7 100644 (file)
@@ -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);
     }