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; }