summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-09-05 06:13:33 -0700
committerJames Moger <james.moger@gitblit.com>2013-09-05 06:13:33 -0700
commita7eb626b89d8870ce211afc1b4927d98dbe4ed03 (patch)
treee1646d53de823c7d79db9c69f717b9ce581664ba
parent7fa7ba0590f819aeda3bcb6d6d1003009d77de65 (diff)
parent86dca9da11d66aba2104ab64fbe3affb5ebf0ff4 (diff)
downloadgitblit-a7eb626b89d8870ce211afc1b4927d98dbe4ed03.tar.gz
gitblit-a7eb626b89d8870ce211afc1b4927d98dbe4ed03.zip
Merge pull request #117 from robinrosenberg/master
NPE fix in default branch determination & NPE fix when commit cache contains removed repo
-rw-r--r--src/main/java/com/gitblit/GitBlit.java2
-rw-r--r--src/main/java/com/gitblit/utils/JGitUtils.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java
index 6ea348d5..111e5951 100644
--- a/src/main/java/com/gitblit/GitBlit.java
+++ b/src/main/java/com/gitblit/GitBlit.java
@@ -3603,7 +3603,7 @@ public class GitBlit implements ServletContextListener {
Date cutoff = CommitCache.instance().getCutoffDate();
for (String repositoryName : getRepositoryList()) {
RepositoryModel model = getRepositoryModel(repositoryName);
- if (model.hasCommits && model.lastChange.after(cutoff)) {
+ if (model != null && model.hasCommits && model.lastChange.after(cutoff)) {
repoCount++;
Repository repository = getRepository(repositoryName);
for (RefModel ref : JGitUtils.getLocalBranches(repository, true, -1)) {
diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java
index 8676d748..3f01eeaf 100644
--- a/src/main/java/com/gitblit/utils/JGitUtils.java
+++ b/src/main/java/com/gitblit/utils/JGitUtils.java
@@ -566,6 +566,8 @@ public class JGitUtils {
try {
if (tree == null) {
ObjectId object = getDefaultBranch(repository);
+ if (object == null)
+ return null;
RevCommit commit = rw.parseCommit(object);
tree = commit.getTree();
}