diff --git a/eeschema/netlist_exporters/netlist_exporter_base.cpp b/eeschema/netlist_exporters/netlist_exporter_base.cpp
index 79c1552fd6..5941a8beef 100644
--- a/eeschema/netlist_exporters/netlist_exporter_base.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_base.cpp
@@ -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 )
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 1bf9587cdb..7972d5f37f 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -717,7 +717,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();
@@ -1664,8 +1664,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();
 
diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp
index bab3412e04..aeac182415 100644
--- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp
+++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp
@@ -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" );
 
diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h
index bb0ca1e1ef..f1e7e1fce8 100644
--- a/eeschema/sch_screen.h
+++ b/eeschema/sch_screen.h
@@ -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; }
 
     /**