DRC dialog: fix a crash when clicking on a item in Footprint Warning panel:

if the warning is a missing footprint, obviously there is no marker associated.
It creates a crash due to a null pointer.

Fixes #4114
https://gitlab.com/kicad/code/kicad/issues/4114
This commit is contained in:
jean-pierre charras 2020-03-28 10:57:52 +01:00
parent 53a98b45f0
commit aebfbda183
1 changed files with 8 additions and 1 deletions

View File

@ -74,7 +74,14 @@ KIID RC_TREE_MODEL::ToUUID( wxDataViewItem aItem )
switch( node->m_Type )
{
case RC_TREE_NODE::MARKER: return rc_item->GetParent()->GetUUID();
case RC_TREE_NODE::MARKER:
// rc_item->GetParent() can be null, if the parent is not existing
// when a RC item has no corresponding ERC/DRC marker
if( rc_item->GetParent() )
return rc_item->GetParent()->GetUUID();
break;
case RC_TREE_NODE::MAIN_ITEM: return rc_item->GetMainItemID();
case RC_TREE_NODE::AUX_ITEM: return rc_item->GetAuxItemID();
}