diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index a676b24e0e..486f97d3f0 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1157,14 +1157,16 @@ public class TestCaseService { List> selecteds = request.getSelected(); TestCaseTest test = new TestCaseTest(); LogUtil.info("关联的测试用例:" + selecteds); - selecteds.forEach(id -> { - test.setTestType(id.get(0)); - test.setTestId(id.get(id.size() - 1)); - test.setCreateTime(System.currentTimeMillis()); - test.setUpdateTime(System.currentTimeMillis()); - test.setTestCaseId(request.getId()); - testCaseTestMapper.insert(test); - }); + if (selecteds != null) { + selecteds.forEach(id -> { + test.setTestType(id.get(0)); + test.setTestId(id.get(id.size() - 1)); + test.setCreateTime(System.currentTimeMillis()); + test.setUpdateTime(System.currentTimeMillis()); + test.setTestCaseId(request.getId()); + testCaseTestMapper.insert(test); + }); + } // 新选择了一个文件,删除原来的文件 List updatedFiles = request.getUpdatedFileList();