CADSTAR PCB: nullptr safety
This commit is contained in:
parent
18e6fa6a53
commit
f693366910
|
@ -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<FOOTPRINT*>( m_cache.at( aLibraryPath ).at( aFootprintName )->Duplicate() );
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue