diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 877bc3151a..70434d6737 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -4378,8 +4378,12 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) // call wx event handler (here so that it also occurs on deselection) // In case of deselection previously selected property // is passed to the event object. - if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) ) - SendEvent( wxEVT_PG_SELECTED, p? p: prevFirstSel, NULL ); + if (!p) + { + p = prevFirstSel; + } + if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) && p) + SendEvent( wxEVT_PG_SELECTED, p, NULL ); return true; }