From 094c286024135a369fe34cc759aaad7cf4dc2ece Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 30 Jul 2015 13:49:35 +0200 Subject: [PATCH] Fixed issues reported by Coverity. --- common/tool/context_menu.cpp | 10 +++++++++- pcbnew/tools/picker_tool.cpp | 12 +++++++++++- pcbnew/tools/selection_conditions.cpp | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp index 884e1f2a29..9f03601fd5 100644 --- a/common/tool/context_menu.cpp +++ b/common/tool/context_menu.cpp @@ -182,7 +182,15 @@ void CONTEXT_MENU::Clear() void CONTEXT_MENU::UpdateAll() { - m_update_handler(); + try + { + m_update_handler(); + } + catch( std::exception& e ) + { + std::cerr << "CONTEXT_MENU error running update handler: " << e.what() << std::endl; + } + updateHotKeys(); runOnSubmenus( boost::bind( &CONTEXT_MENU::UpdateAll, _1 ) ); diff --git a/pcbnew/tools/picker_tool.cpp b/pcbnew/tools/picker_tool.cpp index 50ccbf86c5..d28c6ef1c6 100644 --- a/pcbnew/tools/picker_tool.cpp +++ b/pcbnew/tools/picker_tool.cpp @@ -54,7 +54,17 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) m_picked = controls->GetCursorPosition(); if( m_clickHandler ) - getNext = (*m_clickHandler)( *m_picked ); + { + try + { + getNext = (*m_clickHandler)( *m_picked ); + } + catch( std::exception& e ) + { + std::cerr << "PICKER_TOOL click handler error: " << e.what() << std::endl; + break; + } + } if( !getNext ) break; diff --git a/pcbnew/tools/selection_conditions.cpp b/pcbnew/tools/selection_conditions.cpp index 7d860a41a6..55cbc77c81 100644 --- a/pcbnew/tools/selection_conditions.cpp +++ b/pcbnew/tools/selection_conditions.cpp @@ -136,7 +136,7 @@ bool SELECTION_CONDITIONS::sameNetFunc( const SELECTION& aSelection, bool aAllow if( netcode == NETINFO_LIST::UNCONNECTED && !aAllowUnconnected ) return false; } - else if( netcode != item->GetNetCode() ) + else if( netcode != current_netcode ) { return false; }