Commit 20490ccc authored by Clemens Fries's avatar Clemens Fries Committed by Jim Evins

Prevent crash when using combo search on “Select Product”

GtkSelectionMode can also be GTK_SELECTION_BROWSE, which does not
guarantee that a selection is available. Checking the return value
of gtk_tree_selection_get_selected() seems to provides a clearer
picture.
parent c355458c
......@@ -786,14 +786,15 @@ gl_media_select_get_name (glMediaSelect *this)
g_assert_not_reached ();
}
if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
if (has_selection == TRUE)
{
name = NULL;
gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
}
else
{
gtk_tree_selection_get_selected (selection, &model, &iter);
gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
name = NULL;
}
gl_debug (DEBUG_MEDIA_SELECT, "END");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment