From 2f1911221222ea2f2a66b96c02169b8074a979ea Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 28 Oct 2023 14:34:21 -0400 Subject: [PATCH] Revert fix for false positive Coverity warning. --- common/tool/tool_action.cpp | 13 +------------ common/tool/tool_event.cpp | 16 +++------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp index f188ed6ada..2edc2f2340 100644 --- a/common/tool/tool_action.cpp +++ b/common/tool/tool_action.cpp @@ -126,18 +126,7 @@ TOOL_EVENT TOOL_ACTION::MakeEvent() const if( m_group.has_value() ) { - // This should probably be checking to see if the m_group option is actually - // set rather than attempting to access the value when no option is set. If - // that is the case, then the check above should first check if the options is - // set so that an exception cannot be thrown. - try - { - evt.SetActionGroup( m_group.value() ); - } - catch( const std::bad_optional_access& e ) - { - wxFAIL_MSG( e.what() ); - } + evt.SetActionGroup( m_group.value() ); } if( m_param.has_value() ) diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp index 8a9bdae307..0185c32cbf 100644 --- a/common/tool/tool_event.cpp +++ b/common/tool/tool_event.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN + * Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -157,19 +158,8 @@ const std::string TOOL_EVENT::Format() const if( m_actionGroup.has_value() ) { - // This should probably be checking to see if the m_actionGroup option is - // actually set rather than attempting to access the value when no option - // is set. If that is the case, then the check above should first check - // if the options is set so that an exception cannot be thrown. - try - { - ev += m_actionGroup.value().GetName() + - "(" + std::to_string( m_actionGroup.value().GetGroupID() ) + ")" + " "; - } - catch( const std::bad_optional_access& e ) - { - wxFAIL_MSG( e.what() ); - } + ev += m_actionGroup.value().GetName() + + "(" + std::to_string( m_actionGroup.value().GetGroupID() ) + ")" + " "; } else {