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. * 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) 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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. // the Inspect() function.
SetRefPos( aRefPos ); SetRefPos( aRefPos );
wxCHECK_RET( aItem, "" );
aItem->Visit( m_inspector, nullptr, m_scanTypes ); aItem->Visit( m_inspector, nullptr, m_scanTypes );
// append 2nd list onto end of the first list // append 2nd list onto end of the first list

View File

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