Skip to content

Commit fc12b0b

Browse files
committed
JS: Do not crash on empty package.json file
1 parent 7993a83 commit fc12b0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,9 @@ protected DependencyInstallationResult preparePackagesAndDependencies(Set<Path>
746746
if (file.getFileName().toString().equals("package.json")) {
747747
try {
748748
PackageJson packageJson = new Gson().fromJson(new WholeIO().read(file), PackageJson.class);
749+
if (packageJson == null) {
750+
continue;
751+
}
749752
file = file.toAbsolutePath();
750753
if (tryRelativize(sourceRoot, file) == null) {
751754
continue; // Ignore package.json files outside the source root.

0 commit comments

Comments
 (0)