Avoid Cvpcb crash from malformed fp libraries (namely converted from Eagle) when the fp names are not coded using ASCII/UTF8 code.

This commit is contained in:
jean-pierre charras 2015-07-17 15:13:31 +02:00
parent 40ccc0bedf
commit 3e0334a972
1 changed files with 10 additions and 5 deletions

View File

@ -101,12 +101,17 @@ void FOOTPRINT_INFO::load()
std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) ); std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH ); if( m.get() == NULL ) // Should happen only with malformed/broken libraries
m_keywords = m->GetKeywords(); m_pad_count = 0;
m_doc = m->GetDescription(); else
{
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = m->GetKeywords();
m_doc = m->GetDescription();
// tell ensure_loaded() I'm loaded. // tell ensure_loaded() I'm loaded.
m_loaded = true; m_loaded = true;
}
} }