File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
extensions/ql-vscode/src/packaging Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,15 @@ const ajv = new Ajv({ allErrors: true });
88const qlpackFileValidate = ajv . compile ( qlpackFileSchemaJson ) ;
99
1010export async function loadQlpackFile ( path : string ) : Promise < QlPackFile > {
11- const qlPack = load ( await readFile ( path , "utf8" ) ) as QlPackFile | undefined ;
11+ const qlpackFileText = await readFile ( path , "utf8" ) ;
12+
13+ let qlPack = load ( qlpackFileText ) as QlPackFile | undefined ;
14+
15+ if ( qlPack === undefined || qlPack === null ) {
16+ // An empty file is not valid according to the schema since it's not an object,
17+ // but it is equivalent to an empty object.
18+ qlPack = { } ;
19+ }
1220
1321 qlpackFileValidate ( qlPack ) ;
1422
@@ -20,9 +28,5 @@ export async function loadQlpackFile(path: string): Promise<QlPackFile> {
2028 ) ;
2129 }
2230
23- if ( ! qlPack ) {
24- throw new Error ( `Could not parse ${ path } ` ) ;
25- }
26-
2731 return qlPack ;
2832}
You can’t perform that action at this time.
0 commit comments