diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index ff73d14474..34bd9964dd 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -181,8 +181,12 @@ void wxChoice::DoDeleteOneItem(unsigned int n) GtkTreeModel* model = gtk_combo_box_get_model( combobox ); GtkListStore* store = GTK_LIST_STORE(model); GtkTreeIter iter; - gtk_tree_model_iter_nth_child( model, &iter, - NULL, (gint) n ); + if ( !gtk_tree_model_iter_nth_child(model, &iter, NULL, n) ) + { + // This is really not supposed to happen for a valid index. + wxFAIL_MSG(wxS("Item unexpectedly not found.")); + return; + } gtk_list_store_remove( store, &iter ); m_clientData.RemoveAt( n );