diff options
author | James Moger <james.moger@gitblit.com> | 2013-09-05 06:13:33 -0700 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-09-05 06:13:33 -0700 |
commit | a7eb626b89d8870ce211afc1b4927d98dbe4ed03 (patch) | |
tree | e1646d53de823c7d79db9c69f717b9ce581664ba | |
parent | 7fa7ba0590f819aeda3bcb6d6d1003009d77de65 (diff) | |
parent | 86dca9da11d66aba2104ab64fbe3affb5ebf0ff4 (diff) | |
download | gitblit-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.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/utils/JGitUtils.java | 2 |
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();
}
|