fix(用例评审): 修复用例评审获取评论时会出现的空指针问题

This commit is contained in:
shiziyuan9527 2020-09-25 14:59:45 +08:00
parent 236e572d9b
commit 9e8a8d9caf
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,8 @@ public class TestCaseCommentService {
testCaseComments.forEach(testCaseComment -> { testCaseComments.forEach(testCaseComment -> {
String authorId = testCaseComment.getAuthor(); String authorId = testCaseComment.getAuthor();
User user = userMapper.selectByPrimaryKey(authorId); User user = userMapper.selectByPrimaryKey(authorId);
testCaseComment.setAuthor(user.getName()); String author = user == null ? authorId : user.getName();
testCaseComment.setAuthor(author);
}); });
return testCaseComments; return testCaseComments;
} }