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