From 1b2168af1e5c29ac1c79d501a21eab90c5837d6d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 16 Oct 2020 12:41:19 +0100 Subject: [PATCH] Don't throw implicit rules out after failing to compile user rules. --- pcbnew/drc/drc_engine.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 5201aef37c..33a17e2de2 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -497,10 +497,26 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath ) m_rules.clear(); m_rulesValid = false; - loadImplicitRules(); - loadRules( aRulePath ); + try // attempt to load full set of rules (implicit + user rules) + { + loadImplicitRules(); + loadRules( aRulePath ); + compileRules(); + } + catch( PARSE_ERROR& original_parse_error ) + { + try // try again with just our implicit rules + { + loadImplicitRules(); + compileRules(); + } + catch( PARSE_ERROR& ignore ) + { + wxFAIL_MSG( "Compiling implict rules failed." ); + } - compileRules(); + throw original_parse_error; + } for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii ) m_errorLimits[ ii ] = INT_MAX;