From 27031dd2c55ff4ea0ad3359374f5c00392c130b7 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 28 Feb 2024 16:12:07 +0000 Subject: [PATCH] Check env vars when testing for unresolved variables. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17174 --- pcbnew/drc/drc_test_provider_misc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 99396b74c8..09f62ff149 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -316,11 +316,15 @@ void DRC_TEST_PROVIDER_MISC::testTextVars() return false; BOARD_ITEM* boardItem = dynamic_cast( item ); - EDA_TEXT* text = dynamic_cast( boardItem ); + EDA_TEXT* textItem = dynamic_cast( boardItem ); - wxCHECK( boardItem, false ); + if( !textItem ) + return true; - if( text && text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) ) + wxString resolved = ExpandEnvVarSubstitutions( textItem->GetShownText( true ), + nullptr /*project already done*/ ); + + if( resolved.Matches( wxT( "*${*}*" ) ) ) { std::shared_ptrdrcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE ); drcItem->SetItems( item );