Coverity fixes.

This commit is contained in:
Jeff Young 2023-10-20 16:38:21 +01:00
parent f5e99338a9
commit fc22e602e2
1 changed files with 10 additions and 6 deletions

View File

@ -1060,7 +1060,7 @@ void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard,
{
PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item );
if( bounds.PointInside( track->GetPosition(), 2 )
if( track && bounds.PointInside( track->GetPosition(), 2 )
&& bounds.PointInside( track->GetEnd(), 2 ) )
{
AddItem( item );
@ -1759,10 +1759,14 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
int dummyClearance = std::numeric_limits<int>::max() / 2;
VECTOR2I closestPt;
m_pickerItem->GetEffectiveShape()->Collide( cursorPos, dummyClearance,
&dummyDist, &closestPt );
// With an artificially-large clearance this can't *not* collide, but the
// if stmt keeps Coverity happy....
if( m_pickerItem->GetEffectiveShape()->Collide( cursorPos, dummyClearance,
&dummyDist, &closestPt ) )
{
m_tuningPattern->SetPosition( closestPt );
m_tuningPattern->SetEnd( closestPt );
}
m_preview.Add( m_tuningPattern );
}