Default is a valid netclass, even if it's not in m_NetClasses.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17388

(cherry picked from commit dac16a02cc)
This commit is contained in:
Jeff Young 2024-03-13 15:29:55 +00:00
parent 4dca966c5d
commit 838cefaf48
1 changed files with 5 additions and 1 deletions

View File

@ -559,6 +559,7 @@ int ERC_TESTER::TestMissingNetclasses()
{
int err_count = 0;
std::shared_ptr<NET_SETTINGS>& settings = m_schematic->Prj().GetProjectFile().NetSettings();
wxString defaultNetclass = settings->m_DefaultNetClass->GetName();
auto logError =
[&]( const SCH_SHEET_PATH& sheet, SCH_ITEM* item, const wxString& netclass )
@ -590,10 +591,13 @@ int ERC_TESTER::TestMissingNetclasses()
{
wxString netclass = field->GetText();
if( settings->m_NetClasses.count( netclass ) == 0 )
if( !netclass.IsSameAs( defaultNetclass )
&& settings->m_NetClasses.count( netclass ) == 0 )
{
logError( sheet, item, netclass );
}
}
}
return true;
} );