From fd6bd5dd7c2ad9a90333bbe6d9a9cbdaa7fa5d4f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 12 Oct 2021 16:12:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/track/service/TestPlanService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 77c7b813bb..a5ea95a774 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -202,11 +202,13 @@ public class TestPlanService { String planId = testPlan.getId(); List principals = testPlan.getPrincipals(); - for (String principal : principals) { - TestPlanPrincipal testPlanPrincipal = new TestPlanPrincipal(); - testPlanPrincipal.setTestPlanId(planId); - testPlanPrincipal.setPrincipalId(principal); - testPlanPrincipalService.insert(testPlanPrincipal); + if (!CollectionUtils.isEmpty(principals)) { + for (String principal : principals) { + TestPlanPrincipal testPlanPrincipal = new TestPlanPrincipal(); + testPlanPrincipal.setTestPlanId(planId); + testPlanPrincipal.setPrincipalId(principal); + testPlanPrincipalService.insert(testPlanPrincipal); + } } if (StringUtils.isBlank(testPlan.getProjectId())) {