]> source.dussan.org Git - gitblit.git/commitdiff
Fix NPE when getting user's fork without repository list caching (issue-182)
authorChristian Aistleitner <christian@quelltextlich.at>
Mon, 25 Mar 2013 00:42:23 +0000 (01:42 +0100)
committerChristian Aistleitner <christian@quelltextlich.at>
Mon, 25 Mar 2013 00:42:23 +0000 (01:42 +0100)
When a user does not have a fork of a project, getProjectModel returns
null. So we guard against null before dereferencing the returned
project.

src/com/gitblit/GitBlit.java

index 6bf75d75d6e92e37898baeef0142f07cd26ee014..bb9b988f54c2789612f5d8d792c2d8653502fece 100644 (file)
@@ -1827,6 +1827,9 @@ public class GitBlit implements ServletContextListener {
                } else {\r
                        // not caching\r
                        ProjectModel project = getProjectModel(userProject);\r
+                       if (project == null) {\r
+                               return null;\r
+                       }\r
                        for (String repository : project.repositories) {\r
                                if (repository.startsWith(userProject)) {\r
                                        RepositoryModel model = getRepositoryModel(repository);\r