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 a81b53f786..63bcec8ef0 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -126,8 +126,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()); + } }); } }