From b59910a7496b10cde9a0aadda116865a9c4597e6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 18 Sep 2023 13:41:02 +0200 Subject: [PATCH] catch exception thrown by LIB_TABLE::FindRow(). Previously, was not handled, and crashes Pcbnew. --- pcbnew/fp_tree_synchronizing_adapter.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp index 21907248ad..01c250a607 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * * This program is free software; you can redistribute it and/or @@ -100,12 +100,19 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs ) { if( m_libMap.count( libName ) == 0 ) { - const FP_LIB_TABLE_ROW* library = m_libs->FindRow( libName, true ); - bool pinned = alg::contains( cfg->m_Session.pinned_fp_libs, libName ) - || alg::contains( project.m_PinnedFootprintLibs, libName ); + try + { + const FP_LIB_TABLE_ROW* library = m_libs->FindRow( libName, true ); + bool pinned = alg::contains( cfg->m_Session.pinned_fp_libs, libName ) + || alg::contains( project.m_PinnedFootprintLibs, libName ); - DoAddLibrary( libName, library->GetDescr(), getFootprints( libName ), pinned, true ); - m_libMap.insert( libName ); + DoAddLibrary( libName, library->GetDescr(), getFootprints( libName ), pinned, true ); + m_libMap.insert( libName ); + } + catch( ... ) + { + // do nothing if libname is not found. Just skip it + } } }