File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Extension/src/LanguageServer Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,9 @@ export class CppProperties {
424424
425425 // Try to use the same configuration as before the change.
426426 let newJson : ConfigurationJson = JSON . parse ( readResults ) ;
427+ if ( newJson . configurations . length === 0 ) {
428+ throw { message : "Invalid configuration file. There must be at least one configuration present in the array." } ;
429+ }
427430 if ( ! this . configurationIncomplete && newJson . configurations && this . configurationJson ) {
428431 for ( let i : number = 0 ; i < newJson . configurations . length ; i ++ ) {
429432 if ( newJson . configurations [ i ] . name === this . configurationJson . configurations [ this . CurrentConfiguration ] . name ) {
@@ -433,6 +436,9 @@ export class CppProperties {
433436 }
434437 }
435438 this . configurationJson = newJson ;
439+ if ( this . CurrentConfiguration >= newJson . configurations . length ) {
440+ this . currentConfigurationIndex . Value = this . getConfigIndexForPlatform ( newJson ) ;
441+ }
436442
437443 // Warning: There is a chance that this is incorrect in the event that the c_cpp_properties.json file was created before
438444 // the system includes were available.
You can’t perform that action at this time.
0 commit comments