catch exception thrown by LIB_TABLE::FindRow().

Previously, was not handled, and crashes Pcbnew.
This commit is contained in:
jean-pierre charras 2023-09-18 13:41:02 +02:00
parent ec97ac189c
commit b59910a749
1 changed files with 13 additions and 6 deletions

View File

@ -2,7 +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) 2017 CERN * Copyright (C) 2017 CERN
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -99,6 +99,8 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs )
for( const wxString& libName : m_libs->GetLogicalLibs() ) for( const wxString& libName : m_libs->GetLogicalLibs() )
{ {
if( m_libMap.count( libName ) == 0 ) if( m_libMap.count( libName ) == 0 )
{
try
{ {
const FP_LIB_TABLE_ROW* library = m_libs->FindRow( libName, true ); const FP_LIB_TABLE_ROW* library = m_libs->FindRow( libName, true );
bool pinned = alg::contains( cfg->m_Session.pinned_fp_libs, libName ) bool pinned = alg::contains( cfg->m_Session.pinned_fp_libs, libName )
@ -107,6 +109,11 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs )
DoAddLibrary( libName, library->GetDescr(), getFootprints( libName ), pinned, true ); DoAddLibrary( libName, library->GetDescr(), getFootprints( libName ), pinned, true );
m_libMap.insert( libName ); m_libMap.insert( libName );
} }
catch( ... )
{
// do nothing if libname is not found. Just skip it
}
}
} }
if( m_libMap.size() > count ) if( m_libMap.size() > count )