]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/tabmdi.cpp
Test for wxAuiMDIClientWindow being non-NULL before using it.
[wxWidgets.git] / src / aui / tabmdi.cpp
index 13dc090b019940f362714d496f25f92ba82c1208..edf19a97beda95d7b857cb206ec65e9e1c13659f 100644 (file)
@@ -244,14 +244,18 @@ bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event)
 
 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)
 {
-    if (GetClientWindow()->GetActiveChild() != pChildFrame)
+    wxAuiMDIClientWindow* const client = GetClientWindow();
+    if (client && client->GetActiveChild() != pChildFrame)
     {
-        GetClientWindow()->SetActiveChild(pChildFrame);
+        client->SetActiveChild(pChildFrame);
     }
 }