The Unified and Autonomous Development Platform
Fix the issue that request preview page reprots NPE
robin shenbe038ecf25f5
diff --git a/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java b/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.javaindex f1c39b405b..d95cf514cc 100644--- a/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java+++ b/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java@@ -127,15 +127,16 @@ public class TextDiffPanel extends Panel implements SourceAware {}initialMarks = new ArrayList<>();- MarkPos mark = commentSupport.getMark();- if (mark != null) {- initialMarks.add(mark);- }- for (CodeComment comment: commentSupport.getComments()) {- mark = comment.getMarkPos();- initialMarks.add(mark);+ if (commentSupport != null) {+ MarkPos mark = commentSupport.getMark();+ if (mark != null) {+ initialMarks.add(mark);+ }+ for (CodeComment comment: commentSupport.getComments()) {+ mark = comment.getMarkPos();+ initialMarks.add(mark);+ }}-}private String getJson(MarkPos mark) {diff --git a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.javaindex 5a1a4d18d4..7bd306ae64 100644--- a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java+++ b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java@@ -1270,13 +1270,15 @@ public class RevisionDiffPanel extends Panel {@Nullableprivate CodeComment getOpenComment() {- CodeComment comment = ((CommentSupport)commentSupport).getOpenComment();- if (comment != null) {- String commit = comment.getMarkPos().getCommit();- String oldCommitHash = getOldCommitId().name();- String newCommitHash = getNewCommitId().name();- if (commit.equals(oldCommitHash) || commit.equals(newCommitHash))- return comment;+ if (commentSupport != null) {+ CodeComment comment = ((CommentSupport)commentSupport).getOpenComment();+ if (comment != null) {+ String commit = comment.getMarkPos().getCommit();+ String oldCommitHash = getOldCommitId().name();+ String newCommitHash = getNewCommitId().name();+ if (commit.equals(oldCommitHash) || commit.equals(newCommitHash))+ return comment;+ }}return null;}