Skip to content

Commit

Permalink
fix: check for metadata before accessing
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 committed Sep 10, 2023
1 parent b43f326 commit ce7092e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.github.algomaster99.terminator.commons.cyclonedx.Bom14Schema;
import io.github.algomaster99.terminator.commons.cyclonedx.Component;
import io.github.algomaster99.terminator.commons.cyclonedx.CycloneDX;
import io.github.algomaster99.terminator.commons.cyclonedx.Metadata;
import io.github.algomaster99.terminator.commons.fingerprint.JdkIndexer;
import io.github.algomaster99.terminator.commons.fingerprint.classfile.ClassFileAttributes;
import io.github.algomaster99.terminator.commons.fingerprint.classfile.ClassfileVersion;
Expand Down Expand Up @@ -123,7 +124,12 @@ public Path getOutput() {
}

private void processRootComponent(Bom14Schema sbom) throws IOException, InterruptedException {
Component rootComponent = sbom.getMetadata().getComponent();
Metadata metadata = sbom.getMetadata();
if (metadata == null) {
LOGGER.warn("Metadata is not present.");
return;
}
Component rootComponent = metadata.getComponent();
if (rootComponent == null) {
LOGGER.warn("Root component is not present.");
return;
Expand Down

0 comments on commit ce7092e

Please sign in to comment.