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 747552b019..df3ac9ba69 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -527,7 +527,9 @@ public class ApiAutomationService { objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JSONObject element = JSON.parseObject(definition); try { - return objectMapper.readValue(element.getString("hashTree"), new TypeReference>() {}); + if (element != null) { + return objectMapper.readValue(element.getString("hashTree"), new TypeReference>() {}); + } } catch (JsonProcessingException e) { LogUtil.error(e.getMessage(), e); } @@ -1703,10 +1705,12 @@ public class ApiAutomationService { ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id); String definition = scenario.getScenarioDefinition(); JSONObject object = JSON.parseObject(definition); - object.put("environmentMap", newEnvMap); - String newDefinition = JSON.toJSONString(object); - scenario.setScenarioDefinition(newDefinition); - apiScenarioMapper.updateByPrimaryKeySelective(scenario); + if (object != null) { + object.put("environmentMap", newEnvMap); + String newDefinition = JSON.toJSONString(object); + scenario.setScenarioDefinition(newDefinition); + apiScenarioMapper.updateByPrimaryKeySelective(scenario); + } } }); } diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 6b3097575c..40941ffba6 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -174,11 +174,11 @@ export default { let data = response.data; if (data != null) { //如果树未加载 - if (JSON.stringify(this.moduleOptions) === '{}') { + if (this.moduleOptions && JSON.stringify(this.moduleOptions) === '{}') { this.$refs.nodeTree.list(); } let row = data.listObject[0]; - if (row.tags.length > 0) { + if (row.tags && row.tags.length > 0) { row.tags = JSON.parse(row.tags); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 7d35baa0c2..ab318fd359 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -4,116 +4,130 @@ - + - + - - - - - -