From 9a30da4d1fcba7c42f90b698ed9eb7852b8776da Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Tue, 1 Sep 2009 13:13:58 +0000 Subject: [PATCH] Fixed a severe crash bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/propgridiface.h | 6 +++++- src/propgrid/propgridiface.cpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index cb16eb93d9..29d0116aad 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -1349,13 +1349,17 @@ private: // Cannot be GetGrid() due to ambiguity issues. wxPropertyGrid* GetPropertyGrid() { + if ( !m_pState ) + return NULL; return m_pState->GetGrid(); } // Cannot be GetGrid() due to ambiguity issues. const wxPropertyGrid* GetPropertyGrid() const { - return (const wxPropertyGrid*) m_pState->GetGrid(); + if ( !m_pState ) + return NULL; + return static_cast(m_pState->GetGrid()); } #endif // #ifndef SWIG diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 88e51c6db2..1984ce6bb4 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -217,7 +217,9 @@ wxPGProperty* wxPropertyGridInterface::GetSelection() const bool wxPropertyGridInterface::ClearSelection( bool validation ) { bool res = DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT); - GetPropertyGrid()->Refresh(); + wxPropertyGrid* pg = GetPropertyGrid(); + if ( pg ) + pg->Refresh(); return res; } -- 2.45.2