From 2ad187a3745fcbff8521dc0188298ee159f6e548 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 19 Dec 2019 07:47:07 -0700 Subject: [PATCH] Fix potential NPE issue Signed-off-by: Taylor Smock --- .../josm/plugins/mapwithai/commands/MapWithAIAddCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/commands/MapWithAIAddCommand.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/commands/MapWithAIAddCommand.java index 3aa1ad8..687c468 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/commands/MapWithAIAddCommand.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/commands/MapWithAIAddCommand.java @@ -163,8 +163,9 @@ public class MapWithAIAddCommand extends Command implements Runnable { public Collection getSourceTags() { return sources.entrySet().parallelStream() - .filter(entry -> !editable.getPrimitiveById(entry.getKey()).isDeleted()).map(Entry::getValue) - .filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList()); + .filter(entry -> editable.getPrimitiveById(entry.getKey()) != null + && !editable.getPrimitiveById(entry.getKey()).isDeleted()) + .map(Entry::getValue).filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList()); } @Override