Skip to content

Commit

Permalink
Merge pull request #7 from adamvoss/patch-1
Browse files Browse the repository at this point in the history
Add null check to prevent service from crashing
  • Loading branch information
aeschli authored Jul 3, 2017
2 parents 6a8bb68 + c140d1b commit 1a4e783
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/jsonSchemaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export class JSONSchemaService implements IJSONSchemaService {
let schemaProperties = (<Parser.ObjectASTNode>document.root).properties.filter((p) => (p.key.value === '$schema') && !!p.value);
if (schemaProperties.length > 0) {
let schemeId = <string>schemaProperties[0].value.getValue();
if (Strings.startsWith(schemeId, '.') && this.contextService) {
if (schemeId && Strings.startsWith(schemeId, '.') && this.contextService) {
schemeId = this.contextService.resolveRelativePath(schemeId, resource);
}
if (schemeId) {
Expand Down Expand Up @@ -533,4 +533,4 @@ function toDisplayString(url: string) {
// ignore
}
return url;
}
}

0 comments on commit 1a4e783

Please sign in to comment.