diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index bd249c3e3c..bca8dc1a13 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -2310,6 +2310,9 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) // Restrict the update region to the shape of the window, if any, and also // remember the region that we need to clear later. wxNonOwnedWindow* const tlwParent = wxpeer->MacGetTopLevelWindow(); + if ( tlwParent == NULL ) + return; + const bool isTopLevel = tlwParent == wxpeer; wxRegion clearRgn; if ( tlwParent->GetWindowStyle() & wxFRAME_SHAPED )