]> git.saurik.com Git - wxWidgets.git/commitdiff
Check gtk_tree_model_iter_nth_child() return value in wxChoice code.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Dec 2012 00:37:31 +0000 (00:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Dec 2012 00:37:31 +0000 (00:37 +0000)
This is probably harmless but check the return value just to suppress Coverity
warning about not doing it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/choice.cpp

index ff73d1447488c4531a8e8224a1bb09a1ebf75916..34bd9964ddbe48c255bdd3ba3ee4976fab994ab8 100644 (file)
@@ -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 );