Skip to content

Commit

Permalink
avoid a nullpointer
Browse files Browse the repository at this point in the history
  • Loading branch information
memeeerit committed Nov 29, 2023
1 parent aef9252 commit 92816e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions patchfinder/src/main/java/patches/PatchFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public static void run(int vulnVersionId) throws IOException {
// Get affected products via CVE ids
final Map<String, CpeGroup> affectedProducts = prodRepo.getAffectedProducts(vulnVersionId);
// that db call will return a map with at most one key, the cve id corresponding to the version id
if (affectedProducts.keySet().isEmpty()) {
logger.warn("No affected products found matching CVE '{}', cannot find patches.", vulnVersionId);
return;
}
String cveId = affectedProducts.keySet().iterator().next();
final CpeGroup affectedProduct = affectedProducts.get(cveId);
if(!affectedProducts.keySet().isEmpty() && affectedProduct != null) {
Expand Down

0 comments on commit 92816e7

Please sign in to comment.