Don't eat delete event when there's no item being drawn.

Fixes https://gitlab.com/kicad/code/kicad/issues/8061
This commit is contained in:
Jeff Young 2021-03-29 10:59:21 +01:00
parent 0561ce903e
commit 1b163c5dd3
1 changed files with 6 additions and 9 deletions

View File

@ -299,9 +299,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
symbol->SetPosition( (wxPoint)cursorPos );
m_view->Update( symbol );
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
else if( symbol && evt->IsAction( &ACTIONS::doDelete ) )
{
if( symbol )
cleanup();
}
else
@ -491,9 +490,8 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_view->AddToPreview( image->Clone() );
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
else if( item && evt->IsAction( &ACTIONS::doDelete ) )
{
if( image )
cleanup();
}
else
@ -1125,9 +1123,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
m_view->ClearPreview();
m_view->AddToPreview( item->Clone() );
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
else if( item && evt->IsAction( &ACTIONS::doDelete ) )
{
if( item )
cleanup();
}
else