Ensure the selection is in range.

There are some cases when in the process of closing wxAuiMDIChildFrames that this method will be called while the current selection is out of range.
This commit is contained in:
Robin Dunn
2018-05-02 19:12:41 -07:00
parent 2e8516c5fe
commit c2fcc14bac

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