From def01db5f7dc1c607026528eed1dfd75c6e59779 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 18 Nov 2015 09:19:23 -0500 Subject: Catch some potential NPEs --- src/main/java/com/gitblit/manager/RepositoryManager.java | 7 +++++++ src/main/java/com/gitblit/wicket/pages/ForksPage.java | 3 +++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java index 027ba23b..e2e4de68 100644 --- a/src/main/java/com/gitblit/manager/RepositoryManager.java +++ b/src/main/java/com/gitblit/manager/RepositoryManager.java @@ -1113,9 +1113,16 @@ public class RepositoryManager implements IRepositoryManager { // find the root, cached String key = getRepositoryKey(repository); RepositoryModel model = repositoryListCache.get(key); + if (model == null) { + return null; + } + while (model.originRepository != null) { String originKey = getRepositoryKey(model.originRepository); model = repositoryListCache.get(originKey); + if (model == null) { + return null; + } } ForkModel root = getForkModelFromCache(model.name); return root; diff --git a/src/main/java/com/gitblit/wicket/pages/ForksPage.java b/src/main/java/com/gitblit/wicket/pages/ForksPage.java index 93fc9faf..045f5f7e 100644 --- a/src/main/java/com/gitblit/wicket/pages/ForksPage.java +++ b/src/main/java/com/gitblit/wicket/pages/ForksPage.java @@ -136,6 +136,9 @@ public class ForksPage extends RepositoryPage { protected List flatten(ForkModel node, int level) { List list = new ArrayList(); + if (node == null) { + return list; + } list.add(new FlatFork(node.repository, level)); if (!node.isLeaf()) { for (ForkModel fork : node.forks) { -- cgit v1.2.3