Avoid crashed in eeschema after selecting/deselecting and reselecting highlight tool or delete tool

It was due to use of items in std::deque without testing if these items exist.
This commit is contained in:
jean-pierre charras 2019-06-26 13:17:03 +02:00
parent da645c5d16
commit e800bc5ffe
2 changed files with 6 additions and 6 deletions

View File

@ -452,10 +452,10 @@ void EDA_DRAW_FRAME::PushTool( const std::string& actionName )
void EDA_DRAW_FRAME::PopTool()
{
m_toolStack.pop_back();
if( !m_toolStack.empty() )
if( m_toolStack.size() > 1 )
{
m_toolStack.pop_back();
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( m_toolStack.back() );
if( action )

View File

@ -207,12 +207,12 @@ int ACTION_MANAGER::processHotKey( TOOL_ACTION* aAction, std::map<std::string, i
std::map<std::string, int> aHotKeyMap )
{
aAction->m_hotKey = aAction->m_defaultHotKey;
if( !aAction->m_legacyName.empty() && aLegacyMap.count( aAction->m_legacyName ) )
aAction->SetHotKey( aLegacyMap[ aAction->m_legacyName ] );
if( aHotKeyMap.count( aAction->m_name ) )
aAction->SetHotKey( aHotKeyMap[ aAction->m_name ] );
return aAction->m_hotKey;
}