summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-06-12 17:18:11 -0400
committerJames Moger <james.moger@gitblit.com>2013-06-12 17:18:11 -0400
commit0078c2b7816bcfc32078226e263ce346926014d0 (patch)
tree6b0c5889a1a4e314e2e3c3a702e7411f3897e167 /src/main/java/com/gitblit/models
parent9788200234dfe222989823c6160d2be40fd84415 (diff)
downloadgitblit-0078c2b7816bcfc32078226e263ce346926014d0.tar.gz
gitblit-0078c2b7816bcfc32078226e263ce346926014d0.zip
Workaround incomplete blame commit dara (issue-254)
Diffstat (limited to 'src/main/java/com/gitblit/models')
-rw-r--r--src/main/java/com/gitblit/models/AnnotatedLine.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/models/AnnotatedLine.java b/src/main/java/com/gitblit/models/AnnotatedLine.java
index 69b55bcd..439a3222 100644
--- a/src/main/java/com/gitblit/models/AnnotatedLine.java
+++ b/src/main/java/com/gitblit/models/AnnotatedLine.java
@@ -18,6 +18,7 @@ package com.gitblit.models;
import java.io.Serializable;
import java.util.Date;
+import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
/**
@@ -38,9 +39,15 @@ public class AnnotatedLine implements Serializable {
public final String data;
public AnnotatedLine(RevCommit commit, int lineNumber, String data) {
- this.commitId = commit.getName();
- this.author = commit.getAuthorIdent().getName();
- this.when = commit.getAuthorIdent().getWhen();
+ if (commit == null) {
+ this.commitId = ObjectId.zeroId().getName();
+ this.author = "?";
+ this.when = new Date(0);
+ } else {
+ this.commitId = commit.getName();
+ this.author = commit.getAuthorIdent().getName();
+ this.when = commit.getAuthorIdent().getWhen();
+ }
this.lineNumber = lineNumber;
this.data = data;
}