Browse Source

Prevent crash if generator exists but has no items

See https://gitlab.com/kicad/code/kicad/-/issues/15366
newinvert
Jon Evans 2 years ago
parent
commit
37d9b7fac0
  1. 19
      pcbnew/tools/pcb_selection_tool.cpp

19
pcbnew/tools/pcb_selection_tool.cpp

@ -2367,13 +2367,24 @@ bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect
}
}
if( aItem->Type() == PCB_GENERATOR_T )
aItem = *( static_cast<PCB_GENERATOR*>( aItem )->GetItems().begin() );
if( !aItem )
return false;
switch( aItem->Type() )
KICAD_T itemType = aItem->Type();
if( itemType == PCB_GENERATOR_T )
{
if( static_cast<PCB_GENERATOR*>( aItem )->GetItems().empty() )
{
wxASSERT_MSG( false, "Tried to select an empty generator" );
}
else
{
itemType = ( *static_cast<PCB_GENERATOR*>( aItem )->GetItems().begin() )->Type();
}
}
switch( itemType )
{
case PCB_FOOTPRINT_T:
if( !m_filter.footprints )

Loading…
Cancel
Save