Coverity warning fixes.

This commit is contained in:
Wayne Stambaugh 2023-10-30 09:16:24 -04:00
parent 7959c841fd
commit 6183a1e4de
5 changed files with 22 additions and 6 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013-2021 KiCad Developers, see CHANGELOG.txt for contributors.
* Copyright (C) 2013-2023 KiCad Developers, see CHANGELOG.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -552,7 +552,11 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
static ACTION_MENU* currentMenu;
wxMenuEvent& menuEvent = *dynamic_cast<wxMenuEvent*>( &aEvent );
wxMenuEvent* tmp = dynamic_cast<wxMenuEvent*>( &aEvent );
wxCHECK( tmp, /* void */ );
wxMenuEvent& menuEvent = *tmp;
if( type == wxEVT_MENU_OPEN )
{

View File

@ -942,7 +942,7 @@ void FIELDS_EDITOR_GRID_DATA_MODEL::RemoveSymbol( const SCH_SYMBOL& aSymbol )
// Remove all refs that match this symbol using remove_if
m_symbolsList.erase( std::remove_if( m_symbolsList.begin(), m_symbolsList.end(),
[aSymbol]( const SCH_REFERENCE& ref ) -> bool
[&aSymbol]( const SCH_REFERENCE& ref ) -> bool
{
return ref.GetSymbol()->m_Uuid == aSymbol.m_Uuid;
} ),

View File

@ -172,7 +172,11 @@ wxString SCH_EAGLE_PLUGIN::getLibName()
wxFileName SCH_EAGLE_PLUGIN::getLibFileName()
{
wxFileName fn( m_schematic->Prj().GetProjectPath(), getLibName(), KiCadSymbolLibFileExtension );
wxFileName fn;
wxCHECK( m_schematic, fn );
fn.Assign( m_schematic->Prj().GetProjectPath(), getLibName(), KiCadSymbolLibFileExtension );
return fn;
}

View File

@ -246,6 +246,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
obs.m_clearance = clearance;
obs.m_distFirst = 0;
obs.m_maxFanoutWidth = 0;
obs.m_violatingConstraint = CONSTRAINT_TYPE::CT_CLEARANCE;
aCtx->obstacles.insert( obs );
}
else

View File

@ -468,8 +468,15 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
BOARD_INSPECTION_TOOL* controller = m_toolMgr->GetTool<BOARD_INSPECTION_TOOL>();
if( controller && m_frame->GetPcbNewSettings()->m_ESCClearsNetHighlight )
controller->ClearHighlight( *evt );
try
{
if( controller && m_frame->GetPcbNewSettings()->m_ESCClearsNetHighlight )
controller->ClearHighlight( *evt );
}
catch( const std::runtime_error& e )
{
wxCHECK_MSG( false, 0, e.what() );
}
}
}
}