From 95db94e83ef276bcb163c61c905ab4f77c704d8e Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 11 Mar 2021 10:30:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=94=A8=E6=88=B7=EF=BC=8C=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/service/ApiTestCaseService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 8360c15b4f..1bd15627c2 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -123,8 +123,14 @@ public class ApiTestCaseService { if (!CollectionUtils.isEmpty(userIds)) { Map userMap = userService.queryNameByIds(userIds); apiTestCases.forEach(caseResult -> { - caseResult.setCreateUser(userMap.get(caseResult.getCreateUserId()).getName()); - caseResult.setUpdateUser(userMap.get(caseResult.getUpdateUserId()).getName()); + User createUser = userMap.get(caseResult.getCreateUserId()); + if (createUser != null) { + caseResult.setCreateUser(createUser.getName()); + } + User updateUser = userMap.get(caseResult.getUpdateUserId()); + if (updateUser != null) { + caseResult.setUpdateUser(updateUser.getName()); + } }); } }