Skip to content

Commit

Permalink
fix test add null check
Browse files Browse the repository at this point in the history
Signed-off-by: Sahiba Mittal <[email protected]>
  • Loading branch information
sahibamittal committed Oct 21, 2022
1 parent d080788 commit 1d5fcdc
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,15 @@ public void handle(Component component, JSONObject object, int responseCode) {
Event.dispatch(new IndexEvent(IndexEvent.Action.COMMIT, Vulnerability.class));
}
}
updateAnalysisCacheStats(qm, Vulnerability.Source.SNYK, apiBaseUrl, component.getPurl().toString(), component.getCacheResult());
if (component.getPurl() != null && apiBaseUrl != null) {
updateAnalysisCacheStats(qm, Vulnerability.Source.SNYK, apiBaseUrl, component.getPurl().toString(), component.getCacheResult());
}
} else if (responseCode == 404) {
Vulnerability vulnerability = new Vulnerability();
addVulnerabilityToCache(component, vulnerability);
updateAnalysisCacheStats(qm, Vulnerability.Source.SNYK, apiBaseUrl, component.getPurl().toString(), component.getCacheResult());

if (component.getPurl() != null && apiBaseUrl != null) {
updateAnalysisCacheStats(qm, Vulnerability.Source.SNYK, apiBaseUrl, component.getPurl().toString(), component.getCacheResult());
}
}
}
}
Expand Down

0 comments on commit 1d5fcdc

Please sign in to comment.