Fixed a potential bug when npm ls runs with an error
@@ -26,7 +26,6 @@ import java.util.Map.Entry
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import com.blackducksoftware.integration.hub.bdio.graph.MutableDependencyGraph
@@ -87,6 +86,7 @@ class NpmCliDependencyFinder {
String version = element.getAsJsonPrimitive(JSON_VERSION)?.getAsString()
JsonObject children = element.getAsJsonObject(JSON_DEPENDENCIES)
+ if (name != null && version != null) {
def externalId = externalIdFactory.createNameVersionExternalId(Forge.NPM, name, version)
def child = new Dependency(name, version, externalId)
@@ -99,3 +99,4 @@ class NpmCliDependencyFinder {
}
}
}
+}
