Merge pull request #802 from RobinD42/fix-tabmdi-close

Ensure the selection is in range.
This commit is contained in:
Robin Dunn
2018-05-08 17:46:09 -07:00
committed by GitHub

View File

@@ -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);