Avoid assertion when changing projects

If the regex does not compile, we should not be checking for matches
This commit is contained in:
Seth Hillbrand 2024-01-16 15:23:58 -08:00
parent 8fea4812f3
commit 9077c9fb80

View File

@ -432,10 +432,8 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName,
if( ext == wxT( "" ) ) if( ext == wxT( "" ) )
continue; continue;
reg.Compile( wxString::FromAscii( "^.*\\." ) + ext + wxString::FromAscii( "$" ), if( reg.Compile( wxString::FromAscii( "^.*\\." ) + ext + wxString::FromAscii( "$" ),
wxRE_ICASE ); wxRE_ICASE ) && reg.Matches( aName ) )
if( reg.Matches( aName ) )
{ {
type = (TREE_FILE_TYPE) i; type = (TREE_FILE_TYPE) i;
break; break;