/* Return the value-label pair currently selected in the dialog box */
-static void
+static gboolean
get_selected_tuple (PsppireValLabsDialog *dialog,
union value *valuep, const char **label)
{
GtkTreeModel * model = gtk_tree_view_get_model (treeview);
- gtk_tree_selection_get_selected (sel, &model, &iter);
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
+ return FALSE;
gtk_tree_model_get_value (model, &iter, 1, &the_value);
if (vl != NULL)
*label = val_lab_get_escaped_label (vl);
}
+
+ return TRUE;
}
union value value;
struct val_lab *vl;
- get_selected_tuple (dialog, &value, NULL);
+ if (! get_selected_tuple (dialog, &value, NULL))
+ return;
+
vl = val_labs_lookup (dialog->labs, &value);
if (vl != NULL)
val_labs_remove (dialog->labs, vl);
gchar *text;
- get_selected_tuple (dialog, &value, &label);
+ if (! get_selected_tuple (dialog, &value, &label))
+ return;
+
text = value_to_text__ (value, &dialog->format, dialog->encoding);
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),