From bd75cffff34259e795ebda7123cd0102acbc6480 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 1 Jan 2022 15:28:25 -0800 Subject: [PATCH] Prevent ops on empty selection Fixes https://gitlab.com/kicad/code/kicad/issues/10164 --- pcbnew/tools/edit_tool.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index f951885c07..716adbba82 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1453,6 +1453,10 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) 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 ); VECTOR2I refPt = selection.GetReferencePoint(); @@ -2251,6 +2255,10 @@ bool EDIT_TOOL::updateModificationPoint( PCB_SELECTION& aSelection ) if( m_dragging && aSelection.HasReferencePoint() ) 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... if( aSelection.Size() == 1 ) {