From ba54242b0d080475bbfce2ab559b3fcf2a513a5b Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 22 Oct 2012 16:16:57 -0400 Subject: [PATCH] Fixed null pointer exceptions Manager create User and Team --- src/com/gitblit/client/EditTeamDialog.java | 9 +++++++-- src/com/gitblit/client/EditUserDialog.java | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/com/gitblit/client/EditTeamDialog.java b/src/com/gitblit/client/EditTeamDialog.java index 4eb07295..81146fc6 100644 --- a/src/com/gitblit/client/EditTeamDialog.java +++ b/src/com/gitblit/client/EditTeamDialog.java @@ -49,6 +49,7 @@ import com.gitblit.models.RegistrantAccessPermission; import com.gitblit.models.RepositoryModel; import com.gitblit.models.ServerSettings; import com.gitblit.models.TeamModel; +import com.gitblit.utils.ArrayUtils; import com.gitblit.utils.StringUtils; public class EditTeamDialog extends JDialog { @@ -316,8 +317,12 @@ public class EditTeamDialog extends JDialog { } // remove repositories for which team already has a permission - for (RegistrantAccessPermission rp : permissions) { - restricted.remove(rp.registrant); + if (permissions == null) { + permissions = new ArrayList(); + } else { + for (RegistrantAccessPermission rp : permissions) { + restricted.remove(rp.registrant); + } } StringUtils.sortRepositorynames(restricted); diff --git a/src/com/gitblit/client/EditUserDialog.java b/src/com/gitblit/client/EditUserDialog.java index 5b789da5..da75867f 100644 --- a/src/com/gitblit/client/EditUserDialog.java +++ b/src/com/gitblit/client/EditUserDialog.java @@ -347,9 +347,14 @@ public class EditUserDialog extends JDialog { restricted.add(repo.name); } } + // remove repositories for which user already has a permission - for (RegistrantAccessPermission rp : permissions) { - restricted.remove(rp.registrant); + if (permissions == null) { + permissions = new ArrayList(); + } else { + for (RegistrantAccessPermission rp : permissions) { + restricted.remove(rp.registrant); + } } StringUtils.sortRepositorynames(restricted); -- 2.39.5