diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 305886f890..9088d2f57a 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1204,7 +1204,11 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const if ( y ) pt.y = *y ; if ( !IsTopLevel() ) - HIViewConvertPoint( &pt , *m_peer , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ; + { + wxTopLevelWindowMac* top = MacGetTopLevelWindow(); + if (top) + HIViewConvertPoint( &pt , *m_peer , (ControlRef) top->GetHandle() ) ; + } if ( x ) *x = (int) pt.x ; if ( y ) *y = (int) pt.y ;