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