From 9077c9fb8031fdb58de9af8aeaac6334ab2332a8 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 16 Jan 2024 15:23:58 -0800 Subject: [PATCH] Avoid assertion when changing projects If the regex does not compile, we should not be checking for matches --- kicad/project_tree_pane.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp index d90c9695dc..cc3b7d25f6 100644 --- a/kicad/project_tree_pane.cpp +++ b/kicad/project_tree_pane.cpp @@ -432,10 +432,8 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName, if( ext == wxT( "" ) ) continue; - reg.Compile( wxString::FromAscii( "^.*\\." ) + ext + wxString::FromAscii( "$" ), - wxRE_ICASE ); - - if( reg.Matches( aName ) ) + if( reg.Compile( wxString::FromAscii( "^.*\\." ) + ext + wxString::FromAscii( "$" ), + wxRE_ICASE ) && reg.Matches( aName ) ) { type = (TREE_FILE_TYPE) i; break;