Skip to content

Commit

Permalink
fix: crash when url is undefined (#954)
Browse files Browse the repository at this point in the history
* fix: crash when url is undefined

* add another null check

* style: prettier fix

---------

Co-authored-by: Muthurajan Sivasubramanian <[email protected]>
  • Loading branch information
GustavEikaas and msivasubramaniaan authored May 29, 2024
1 parent 0871dc1 commit 7203630
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/languageserver/handlers/settingsHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class SettingsHandler {

if (settings.yaml.schemaStore) {
this.yamlSettings.schemaStoreEnabled = settings.yaml.schemaStore.enable;
if (settings.yaml.schemaStore.url.length !== 0) {
if (settings.yaml.schemaStore.url?.length !== 0) {
this.yamlSettings.schemaStoreUrl = settings.yaml.schemaStore.url;
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ export class SettingsHandler {
private async setSchemaStoreSettingsIfNotSet(): Promise<void> {
const schemaStoreIsSet = this.yamlSettings.schemaStoreSettings.length !== 0;
let schemaStoreUrl = '';
if (this.yamlSettings.schemaStoreUrl.length !== 0) {
if (this.yamlSettings.schemaStoreUrl?.length !== 0) {
schemaStoreUrl = this.yamlSettings.schemaStoreUrl;
} else {
schemaStoreUrl = JSON_SCHEMASTORE_URL;
Expand Down

0 comments on commit 7203630

Please sign in to comment.