From 6d23cab9f5387ca2b57f60b26936ff8af0acc8fa Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 19 Oct 2012 22:45:30 -0400 Subject: [PATCH] Added UserModel null check --- src/com/gitblit/wicket/pages/RepositoryPage.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java index fd2cbccc..bacf233d 100644 --- a/src/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/com/gitblit/wicket/pages/RepositoryPage.java @@ -95,10 +95,12 @@ public abstract class RepositoryPage extends BasePage { if (objectId != null) { RefModel branch = null; if ((branch = JGitUtils.getBranch(getRepository(), objectId)) != null) { - boolean canAccess = GitBlitWebSession - .get() - .getUser() - .hasBranchPermission(getRepositoryModel().name, + UserModel user = GitBlitWebSession.get().getUser(); + if (user == null) { + // workaround until get().getUser() is reviewed throughout the app + user = UserModel.ANONYMOUS; + } + boolean canAccess = user.hasBranchPermission(repositoryName, branch.reference.getName()); if (!canAccess) { error("Access denied", true); -- 2.39.5