Footprint Editor: Fix crash when no footprint loaded and try to select something

This commit is contained in:
jean-pierre charras 2024-04-21 15:46:19 +02:00
parent ca18dc8ec8
commit 1dc8585d04
2 changed files with 7 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -493,6 +493,7 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const std::vector<KICAD_T>&
// the Inspect() function.
SetRefPos( aRefPos );
wxCHECK_RET( aItem, "" );
aItem->Visit( m_inspector, nullptr, m_scanTypes );
// append 2nd list onto end of the first list

View File

@ -413,10 +413,13 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
GENERAL_COLLECTOR collector;
if( m_isFootprintEditor )
{
if( board()->GetFirstFootprint() )
{
collector.Collect( board()->GetFirstFootprint(), { PCB_TABLECELL_T },
evt->DragOrigin(), guide );
}
}
else
{
collector.Collect( board(), { PCB_TABLECELL_T }, evt->DragOrigin(), guide );