]> source.dussan.org Git - gitblit.git/commitdiff
Catch some potential NPEs
authorJames Moger <james.moger@gitblit.com>
Wed, 18 Nov 2015 14:19:23 +0000 (09:19 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 18 Nov 2015 14:19:23 +0000 (09:19 -0500)
src/main/java/com/gitblit/manager/RepositoryManager.java
src/main/java/com/gitblit/wicket/pages/ForksPage.java

index 027ba23b5c0d17da1ed4cb2acc1a013ae8a22423..e2e4de686d99fd2d3fffb322c0b7468fcac18df1 100644 (file)
@@ -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;
index 93fc9fafd8ad3b648d5aad544229bad907a85023..045f5f7e2e40111adacac2464c04c998d570ad5e 100644 (file)
@@ -136,6 +136,9 @@ public class ForksPage extends RepositoryPage {
 \r
        protected List<FlatFork> flatten(ForkModel node, int level) {\r
                List<FlatFork> list = new ArrayList<FlatFork>();\r
+               if (node == null) {\r
+                       return list;\r
+               }\r
                list.add(new FlatFork(node.repository, level));\r
                if (!node.isLeaf()) {\r
                        for (ForkModel fork : node.forks) {\r