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.
This commit is contained in:
Artur Wieczorek
2020-01-23 19:42:37 +01:00
parent a5d9fe2931
commit 750f3cb783

View File

@@ -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();