diff --git a/src/msw/window.cpp b/src/msw/window.cpp index f113a10f7e..6fc526fac7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3601,7 +3601,11 @@ wxWindowMSW::MSWOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), { wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData); - wxCHECK_MSG( pMenuItem && pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), + // see comment before the same test in MSWOnMeasureItem() below + if ( !pMenuItem ) + return false; + + wxCHECK_MSG( wxDynamicCast(pMenuItem, wxMenuItem), false, _T("MSWOnDrawItem: bad wxMenuItem pointer") ); // prepare to call OnDrawItem(): notice using of wxDCTemp to prevent