diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 7483b5e6e2..8096f1e974 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -115,7 +115,9 @@ public class ApiAutomationService { if (map != null) { if (map.isEmpty()) { List ids = (List) JSONPath.read(definition, "$..projectId"); - idList.addAll(new HashSet<>(ids)); + if (CollectionUtils.isNotEmpty(ids)) { + idList.addAll(new HashSet<>(ids)); + } } else { Set set = d.getEnvironmentMap().keySet(); idList = new ArrayList<>(set);