diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.cpp index 9b91de9da1..7c69464080 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.cpp @@ -185,23 +185,6 @@ void CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintEnumerate( wxArrayString& aFoo } -const FOOTPRINT* -CADSTAR_PCB_ARCHIVE_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const STRING_UTF8_MAP* aProperties ) -{ - ensureLoadedLibrary( aLibraryPath ); - - if( !m_cache.count( aLibraryPath ) ) - return nullptr; - - if( !m_cache.at( aLibraryPath ).count( aFootprintName ) ) - return nullptr; - - return m_cache.at( aLibraryPath ).at( aFootprintName ).get(); -} - - bool CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, const STRING_UTF8_MAP* aProperties ) @@ -231,6 +214,9 @@ FOOTPRINT* CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintLoad( const wxString& aLi if( !m_cache.at( aLibraryPath ).count( aFootprintName ) ) return nullptr; + if( !m_cache.at( aLibraryPath ).at( aFootprintName ) ) + return nullptr; + return static_cast( m_cache.at( aLibraryPath ).at( aFootprintName )->Duplicate() ); } diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.h index 7554f476d6..91ae90bf05 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_plugin.h @@ -78,9 +78,7 @@ public: void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP* aProperties = nullptr ) override; - const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const STRING_UTF8_MAP* aProperties = nullptr ) override; + // default implementation of GetEnumeratedFootprint is fine (call FootprintLoad) bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, const STRING_UTF8_MAP* aProperties = nullptr ) override;