wxAuiMDIParentFrame::GetActiveChild() may be called before the client window
is created, don't crash in this case but just return NULL.
Closes #14684.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72601
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxAuiMDIChildFrame *wxAuiMDIParentFrame::GetActiveChild() const
{
wxAuiMDIChildFrame *wxAuiMDIParentFrame::GetActiveChild() const
{
- return GetClientWindow()->GetActiveChild();
+ // We can be called before the client window is created, so check for its
+ // existence.
+ wxAuiMDIClientWindow* const client = GetClientWindow();
+ return client ? client->GetActiveChild() : NULL;
}
void wxAuiMDIParentFrame::SetActiveChild(wxAuiMDIChildFrame* pChildFrame)
{
}
void wxAuiMDIParentFrame::SetActiveChild(wxAuiMDIChildFrame* pChildFrame)
{
- if (GetClientWindow()->GetActiveChild() != pChildFrame)
+ wxAuiMDIClientWindow* const client = GetClientWindow();
+ if (client && client->GetActiveChild() != pChildFrame)
- GetClientWindow()->SetActiveChild(pChildFrame);
+ client->SetActiveChild(pChildFrame);