diff --git a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp index d8ee82cb46..92871cf22d 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp @@ -670,7 +670,20 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadField( std::unique_ptr& aSym } else { - parseQuotedString( field->m_name, aReader, line, &line, true ); // Optional. + wxString fieldName = wxEmptyString; + parseQuotedString( fieldName, aReader, line, &line, true ); // Optional. + + if( fieldName.IsEmpty() ) + return; + + wxString candidateFieldName = fieldName; + int suffix = 0; + + //Deduplicate field name + while( aSymbol->FindField( candidateFieldName ) != nullptr ) + candidateFieldName = wxString::Format( "%s_%d", fieldName, ++suffix ); + + field->m_name = candidateFieldName; } }