Fixed a crash in EE_SELECTION_TOOL::SelectPoint()

The for loop is continued after an item removal, so the removed item
is not accessed anymore.
This commit is contained in:
Maciej Suminski 2019-06-14 13:00:39 +02:00
parent dc56678289
commit 7d69a917b9
1 changed files with 7 additions and 1 deletions

View File

@ -486,16 +486,22 @@ EDA_ITEM* EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T*
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
collector.Collect( start, aFilterList, (wxPoint) aWhere, m_unit, m_convert );
bool anyCollected = collector.GetCount() != 0;
bool anyCollected = collector.GetCount() > 0;
// Post-process collected items
for( int i = collector.GetCount() - 1; i >= 0; --i )
{
if( !selectable( collector[ i ] ) )
{
collector.Remove( i );
continue;
}
if( aCheckLocked && collector[ i ]->IsLocked() )
{
collector.Remove( i );
continue;
}
// SelectPoint, unlike other selection routines, can select line ends
if( collector[ i ]->Type() == SCH_LINE_T )