From: James Moger Date: Sat, 20 Oct 2012 02:45:30 +0000 (-0400) Subject: Added UserModel null check X-Git-Tag: v1.2.0~156 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6d23cab9f5387ca2b57f60b26936ff8af0acc8fa;p=gitblit.git Added UserModel null check --- 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);