X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22cbd10ea3ab5fead0bbb07107c45d584809fbc3..c71d3313a42a8fdc6efd6a0c49ad13def665ef2f:/src/gtk/notebook.cpp?ds=sidebyside

diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp
index 0621f9fe5b..a904117faf 100644
--- a/src/gtk/notebook.cpp
+++ b/src/gtk/notebook.cpp
@@ -189,6 +189,8 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
     if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
     {
         int sel = win->GetSelection();
+        if (sel == -1)
+            return TRUE;
         wxGtkNotebookPage *nb_page = win->GetNotebookPage(sel);
         wxCHECK_MSG( nb_page, FALSE, _T("invalid selection in wxNotebook") );
 
@@ -371,7 +373,7 @@ int wxNotebook::SetSelection( int page )
 {
     wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
 
-    wxCHECK_MSG( page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
+    wxCHECK_MSG( page >= 0 && page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
 
     int selOld = GetSelection();