Don't accidentally add NULL ptrs to the LibSymbols cache.
Operator[] will add a blank element if it isn't found in the map. Probably Sentry KICAD-23Y. Fixes https://gitlab.com/kicad/code/kicad/-/issues/14927
This commit is contained in:
parent
93789e75b9
commit
96073402ce
|
@ -94,9 +94,12 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
|
|||
|
||||
wxCHECK( screen, nullptr );
|
||||
|
||||
LIB_SYMBOL* libSymbol = screen->GetLibSymbols()[ symbol->GetSchSymbolLibraryName() ];
|
||||
auto it = screen->GetLibSymbols().find( symbol->GetSchSymbolLibraryName() );
|
||||
|
||||
wxCHECK( libSymbol, nullptr );
|
||||
if( it == screen->GetLibSymbols().end() )
|
||||
return nullptr;
|
||||
|
||||
LIB_SYMBOL* libSymbol = it->second;
|
||||
|
||||
// If symbol is a "multi parts per package" type
|
||||
if( libSymbol->GetUnitCount() > 1 )
|
||||
|
|
|
@ -816,7 +816,7 @@ void SCH_EDIT_FRAME::HardRedraw()
|
|||
for( SCH_ITEM* item : screen->Items() )
|
||||
item->ClearCaches();
|
||||
|
||||
for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
|
||||
for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
|
||||
{
|
||||
wxCHECK2( libSymbol.second, continue );
|
||||
libSymbol.second->ClearCaches();
|
||||
|
@ -1971,8 +1971,8 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
|||
for( SCH_ITEM* item : screen->Items() )
|
||||
item->ClearCaches();
|
||||
|
||||
for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
|
||||
libSymbol.second->ClearCaches();
|
||||
for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
|
||||
libSymbol->ClearCaches();
|
||||
|
||||
GetCanvas()->ForceRefresh();
|
||||
|
||||
|
|
|
@ -376,8 +376,8 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
// Save cache library.
|
||||
m_out->Print( 1, "(lib_symbols\n" );
|
||||
|
||||
for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
|
||||
SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( libSymbol.second, *m_out, 2, libSymbol.first );
|
||||
for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
|
||||
SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( libSymbol, *m_out, 2, libItemName );
|
||||
|
||||
m_out->Print( 1, ")\n\n" );
|
||||
|
||||
|
|
|
@ -478,7 +478,6 @@ public:
|
|||
*
|
||||
* @return The list of unique #LIB_SYMBOL object pointers.
|
||||
*/
|
||||
std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() { return m_libSymbols; }
|
||||
const std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() const { return m_libSymbols; }
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue