From: George Tasker Date: Sat, 27 Jan 2001 12:55:44 +0000 (+0000) Subject: Added a check to make sure 'parent' is valid, otherwise a crash could occur X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/89e3037cc9ef8b040f818f90b0a4c04a8fbda6c1 Added a check to make sure 'parent' is valid, otherwise a crash could occur git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 84dc12f4b7..740a47fe7a 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1150,11 +1150,14 @@ void wxWindow::DoGetPosition(int *x, int *y) const ::ScreenToClient(hParentWnd, &point); } - // We may be faking the client origin. So a window that's really at (0, - // 30) may appear (to wxWin apps) to be at (0, 0). - wxPoint pt(parent->GetClientAreaOrigin()); - point.x -= pt.x; - point.y -= pt.y; + if ( parent ) + { + // We may be faking the client origin. So a window that's really at (0, + // 30) may appear (to wxWin apps) to be at (0, 0). + wxPoint pt(parent->GetClientAreaOrigin()); + point.x -= pt.x; + point.y -= pt.y; + } } if ( x )