From 750f3cb783ea2fb8cb4f734e0a62f9ec91721032 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 23 Jan 2020 19:42:37 +0100 Subject: [PATCH] Return invalid wxPGCell on attempt to get a cell for unattached wxPGProperty This is to avoid crash if GetCell() would be called for wxPGProperty not currently attached to a wxPropertyGrid. --- src/propgrid/property.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index d14dc9130f..b793f39151 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1693,6 +1693,11 @@ const wxPGCell& wxPGProperty::GetCell( unsigned int column ) const wxPropertyGrid* pg = GetGrid(); wxASSERT_MSG( pg, wxS("Cannot get cell for detached property") ); + if ( !pg ) + { + static const wxPGCell invalidCell; + return invalidCell; + } if ( IsCategory() ) return pg->GetCategoryDefaultCell();