Skip to content

Commit 11b68b9

Browse files
committed
Error when loading HTML and no script element exists.
1 parent 66a2092 commit 11b68b9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/jsonld.js

+8
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,14 @@ jsonld.get = async function(url, options) {
940940
});
941941
}
942942
if(frag || !options.extractAllScripts) {
943+
if(!remoteDoc.document[0]) {
944+
throw new JsonLdError(
945+
`No script tag found.`,
946+
'jsonld.InvalidScriptElement', {
947+
code: 'loading document failed',
948+
remoteDoc
949+
});
950+
}
943951
remoteDoc.document = remoteDoc.document[0];
944952
}
945953
} else {

0 commit comments

Comments
 (0)