Prevent ops on empty selection

Fixes https://gitlab.com/kicad/code/kicad/issues/10164

(cherry picked from commit bd75cffff3)
This commit is contained in:
Seth Hillbrand 2022-01-01 15:28:25 -08:00
parent dafa8ec671
commit 410ed8a071
1 changed files with 8 additions and 0 deletions

View File

@ -1455,6 +1455,10 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
true /* prompt user regarding locked items */ ); true /* prompt user regarding locked items */ );
} }
// Did we filter everything out? If so, don't try to operate further
if( selection.Empty() )
return 0;
updateModificationPoint( selection ); updateModificationPoint( selection );
VECTOR2I refPt = selection.GetReferencePoint(); VECTOR2I refPt = selection.GetReferencePoint();
@ -2253,6 +2257,10 @@ bool EDIT_TOOL::updateModificationPoint( PCB_SELECTION& aSelection )
if( m_dragging && aSelection.HasReferencePoint() ) if( m_dragging && aSelection.HasReferencePoint() )
return false; return false;
// Can't modify an empty group
if( aSelection.Empty() )
return false;
// When there is only one item selected, the reference point is its position... // When there is only one item selected, the reference point is its position...
if( aSelection.Size() == 1 ) if( aSelection.Size() == 1 )
{ {