]> source.dussan.org Git - gitblit.git/commitdiff
Added null checkinng and logging for edit user permissions (issue 155)
authorJames Moger <james.moger@gitblit.com>
Tue, 30 Oct 2012 21:05:30 +0000 (17:05 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 30 Oct 2012 21:05:30 +0000 (17:05 -0400)
src/com/gitblit/wicket/pages/EditUserPage.java

index 7942d6fab020271a2da93070cca3d674a66c93f2..05aee6dc5888b8fba5092c47c5e52a880f3802ae 100644 (file)
@@ -33,13 +33,15 @@ import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.Model;\r
 import org.apache.wicket.model.util.CollectionModel;\r
 import org.apache.wicket.model.util.ListModel;\r
+import org.slf4j.LoggerFactory;\r
 \r
+import com.gitblit.Constants.PermissionType;\r
+import com.gitblit.Constants.RegistrantType;\r
 import com.gitblit.GitBlit;\r
 import com.gitblit.GitBlitException;\r
 import com.gitblit.Keys;\r
-import com.gitblit.Constants.PermissionType;\r
-import com.gitblit.Constants.RegistrantType;\r
 import com.gitblit.models.RegistrantAccessPermission;\r
+import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.TeamModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.StringUtils;\r
@@ -109,7 +111,12 @@ public class EditUserPage extends RootSubPage {
                                // Ensure this is NOT an owner permission - which is non-editable\r
                                // We don't know this from within the usermodel, ownership is a\r
                                // property of a repository.\r
-                               boolean isOwner = GitBlit.self().getRepositoryModel(permission.registrant).isOwner(oldName);\r
+                               RepositoryModel rm = GitBlit.self().getRepositoryModel(permission.registrant);\r
+                               if (rm == null) {\r
+                                       LoggerFactory.getLogger(getClass()).error("Missing repository " + permission.registrant, new NullPointerException());\r
+                                       continue;\r
+                               }\r
+                               boolean isOwner = rm.isOwner(oldName);\r
                                if (isOwner) {\r
                                        permission.permissionType = PermissionType.OWNER;\r
                                        permission.isEditable = false;\r