JS: Do not crash on empty package.json file

This commit is contained in:
Asger Feldthaus
2020-10-26 09:21:01 +00:00
parent 7993a83750
commit fc12b0bb5e

View File

@@ -746,6 +746,9 @@ protected DependencyInstallationResult preparePackagesAndDependencies(Set<Path>
if (file.getFileName().toString().equals("package.json")) {
try {
PackageJson packageJson = new Gson().fromJson(new WholeIO().read(file), PackageJson.class);
if (packageJson == null) {
continue;
}
file = file.toAbsolutePath();
if (tryRelativize(sourceRoot, file) == null) {
continue; // Ignore package.json files outside the source root.