From aebfbda183287af48a75614cf5fe44e35140f516 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 28 Mar 2020 10:57:52 +0100 Subject: [PATCH] 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 --- common/rc_item.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/rc_item.cpp b/common/rc_item.cpp index d366d396b4..29a8575ed7 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -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(); }