This repository was archived by the owner on Aug 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,16 @@ private void documentSaved(Document document)
219219 {
220220 return ;
221221 }
222- var currentConfig = document . ProjectItem . ConfigurationManager . ActiveConfiguration ;
222+
223+ Configuration currentConfig = null ;
224+ try { currentConfig = document . ProjectItem . ConfigurationManager . ActiveConfiguration ; }
225+ catch ( Exception ) { currentConfig = null ; }
226+ if ( currentConfig == null )
227+ {
228+ MessageBox . Show ( "Cannot perform check - no valid configuration selected" , "Cppcheck error" ) ;
229+ return ;
230+ }
231+
223232 SourceFile sourceForAnalysis = createSourceFile ( document . FullName , currentConfig , project ) ;
224233 if ( sourceForAnalysis == null )
225234 return ;
@@ -266,7 +275,13 @@ private void checkCurrentProject()
266275 System . Windows . MessageBox . Show ( "Only C++ projects can be checked." ) ;
267276 return ;
268277 }
269- currentConfig = ( ( Project ) o ) . ConfigurationManager . ActiveConfiguration ;
278+ try { currentConfig = ( ( Project ) o ) . ConfigurationManager . ActiveConfiguration ; }
279+ catch ( Exception ) { currentConfig = null ; }
280+ if ( currentConfig == null )
281+ {
282+ MessageBox . Show ( "Cannot perform check - no valid configuration selected" , "Cppcheck error" ) ;
283+ return ;
284+ }
270285 dynamic projectFiles = project . Files ;
271286 foreach ( dynamic file in projectFiles )
272287 {
You can’t perform that action at this time.
0 commit comments