Browse Source

Eeschema: Check for NULL pointer when using interactive delete tool

CHANGED: If you start the interactive delete tool and the mouse pointer
isn't near anything, Eeschema tries to use a null EDA_ITEM pointer
which throws an exception.  This commit checks if the pointer is null
and exits if it is.
pull/16/head
PJM 5 years ago
committed by Ian McInerney
parent
commit
b0e05ad9bf
  1. 21
      eeschema/tools/ee_selection_tool.cpp

21
eeschema/tools/ee_selection_tool.cpp

@ -726,18 +726,21 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
}
}
EDA_RECT tightBox = closest->GetBoundingBox();
tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
for( int i = collector.GetCount() - 1; i >= 0; --i )
if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
{
EDA_ITEM* item = collector[ i ];
EDA_RECT tightBox = closest->GetBoundingBox();
tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
if( item == closest )
continue;
for( int i = collector.GetCount() - 1; i >= 0; --i )
{
EDA_ITEM* item = collector[i];
if( item == closest )
continue;
if( !item->HitTest( tightBox, true ) )
collector.Transfer( item );
if( !item->HitTest( tightBox, true ) )
collector.Transfer( item );
}
}
}

Loading…
Cancel
Save