]> source.dussan.org Git - gitblit.git/commitdiff
Added UserModel null check
authorJames Moger <james.moger@gitblit.com>
Sat, 20 Oct 2012 02:45:30 +0000 (22:45 -0400)
committerJames Moger <james.moger@gitblit.com>
Sat, 20 Oct 2012 02:45:30 +0000 (22:45 -0400)
src/com/gitblit/wicket/pages/RepositoryPage.java

index fd2cbccc608ca954984755795d585f88459a0fd9..bacf233defed91c2821e5dedd7908100932b839f 100644 (file)
@@ -95,10 +95,12 @@ public abstract class RepositoryPage extends BasePage {
                if (objectId != null) {\r
                        RefModel branch = null;\r
                        if ((branch = JGitUtils.getBranch(getRepository(), objectId)) != null) {\r
-                               boolean canAccess = GitBlitWebSession\r
-                                               .get()\r
-                                               .getUser()\r
-                                               .hasBranchPermission(getRepositoryModel().name,\r
+                               UserModel user = GitBlitWebSession.get().getUser();\r
+                               if (user == null) {\r
+                                       // workaround until get().getUser() is reviewed throughout the app\r
+                                       user = UserModel.ANONYMOUS;\r
+                               }\r
+                               boolean canAccess = user.hasBranchPermission(repositoryName,\r
                                                                branch.reference.getName());\r
                                if (!canAccess) {\r
                                        error("Access denied", true);\r