From 93f98981892cd74e9074fac9a63cd009b3173340 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 31 Oct 2012 08:28:53 -0400 Subject: [PATCH] Handle case of missing repository in Manager (issue 155) --- src/com/gitblit/client/UsersPanel.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/gitblit/client/UsersPanel.java b/src/com/gitblit/client/UsersPanel.java index cd571b26..2c1481a4 100644 --- a/src/com/gitblit/client/UsersPanel.java +++ b/src/com/gitblit/client/UsersPanel.java @@ -25,6 +25,7 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -43,6 +44,7 @@ import javax.swing.table.TableRowSorter; import com.gitblit.Constants.PermissionType; import com.gitblit.Constants.RpcRequest; import com.gitblit.models.RegistrantAccessPermission; +import com.gitblit.models.RepositoryModel; import com.gitblit.models.TeamModel; import com.gitblit.models.UserModel; import com.gitblit.utils.StringUtils; @@ -318,7 +320,13 @@ public abstract class UsersPanel extends JPanel { // Ensure this is NOT an owner permission - which is non-editable // We don't know this from within the usermodel, ownership is a // property of a repository. - boolean isOwner = gitblit.getRepository(permission.registrant).isOwner(user.username); + RepositoryModel rm = gitblit.getRepository(permission.registrant); + if (rm == null) { + System.out.println(MessageFormat.format("{0}: failed to find registrant repository {1}", + getClass().getSimpleName(), permission.registrant)); + continue; + } + boolean isOwner = rm.isOwner(user.username); if (isOwner) { permission.permissionType = PermissionType.OWNER; permission.isEditable = false; -- 2.39.5