Protect schematic undo list actions

The undo/redo lists can have non-SCH_ITEM elements such as worksheet
items.  When re-doing connectivity, we only need the schematic items, so
we pass on these

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16752
This commit is contained in:
Seth Hillbrand 2024-01-25 16:45:48 -08:00
parent b8a2b3b2bf
commit bba0a8d038
1 changed files with 2 additions and 4 deletions

View File

@ -1712,12 +1712,10 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
for( unsigned ii = 0; ii < changed_list->GetCount(); ++ii )
{
SCH_ITEM* item = static_cast<SCH_ITEM*>( changed_list->GetPickedItem( ii ) );
wxCHECK2( item, continue );
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( changed_list->GetPickedItem( ii ) );
// Ignore objects that are not connectable.
if( !item->IsConnectable() )
if( !item || !item->IsConnectable() )
continue;
SCH_SCREEN* screen = static_cast<SCH_SCREEN*>( changed_list->GetScreenForItem( ii ) );