Fixing a null pointer exception when NPM has null dependencies in the lock file.
@@ -51,6 +51,7 @@ public class NpmLockfilePackager {
final LazyExternalIdDependencyGraphBuilder lazyBuilder = new LazyExternalIdDependencyGraphBuilder();
final NpmProject npmProject = gson.fromJson(lockFileText, NpmProject.class);
+ if (npmProject.dependencies != null) {
npmProject.dependencies.forEach((name, npmDependency) -> {
if (shouldInclude(npmDependency, includeDevDependencies)) {
final DependencyId dependency = createDependencyId(name, npmDependency.version);
@@ -65,6 +66,7 @@ public class NpmLockfilePackager {
}
}
});
+ }
final DependencyGraph graph = lazyBuilder.build();
final ExternalId projectId = externalIdFactory.createNameVersionExternalId(Forge.NPM, npmProject.name, npmProject.version);
