diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 4d619c2a3f..c484d9b701 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -820,7 +820,7 @@ int wxAuiMDIClientWindow::SetSelection(size_t nPage) wxAuiMDIChildFrame* wxAuiMDIClientWindow::GetActiveChild() { const int sel = GetSelection(); - if ( sel == wxNOT_FOUND ) + if ( sel == wxNOT_FOUND || sel >= GetPageCount() ) return NULL; return wxStaticCast(GetPage(sel), wxAuiMDIChildFrame);