Revert fix for false positive Coverity warning.

This commit is contained in:
Wayne Stambaugh 2023-10-28 14:34:21 -04:00
parent 30ba1b8007
commit 2f19112212
2 changed files with 4 additions and 25 deletions

View File

@ -125,20 +125,9 @@ TOOL_EVENT TOOL_ACTION::MakeEvent() const
evt = TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope ); evt = TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope );
if( m_group.has_value() ) 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() ); evt.SetActionGroup( m_group.value() );
} }
catch( const std::bad_optional_access& e )
{
wxFAIL_MSG( e.what() );
}
}
if( m_param.has_value() ) if( m_param.has_value() )
evt.SetParameter( m_param ); evt.SetParameter( m_param );

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -156,21 +157,10 @@ const std::string TOOL_EVENT::Format() const
ev += "action-group: "; ev += "action-group: ";
if( m_actionGroup.has_value() ) 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() + ev += m_actionGroup.value().GetName() +
"(" + std::to_string( m_actionGroup.value().GetGroupID() ) + ")" + " "; "(" + std::to_string( m_actionGroup.value().GetGroupID() ) + ")" + " ";
} }
catch( const std::bad_optional_access& e )
{
wxFAIL_MSG( e.what() );
}
}
else else
{ {
ev += "none"; ev += "none";