From c2fcc14bac7910d04fd9f064136fb5cd5f6fca28 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 2 May 2018 19:12:41 -0700 Subject: [PATCH] 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. --- src/aui/tabmdi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);