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 e5c62f44b2..7e72e61f71 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -707,7 +707,9 @@ public class ApiAutomationService { apiScenarios.forEach(item -> { JSONObject object = JSONObject.parseObject(item.getScenarioDefinition()); object.put("environmentId", request.getEnvironmentId()); - item.setScenarioDefinition(JSONObject.toJSONString(object)); + if (object != null) { + item.setScenarioDefinition(JSONObject.toJSONString(object)); + } apiScenarioMapper.updateByPrimaryKeySelective(item); }); }