diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java index 5f2adfdccfbb..e4026ba9b8fb 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java @@ -5055,7 +5055,7 @@ public static Set extractVisibleEnvironmentsForUser(List en String[] permittedRoles = environment.getVisibilityRoles(); if (permittedRoles != null && permittedRoles[0].equals("all")) { environmentStringSet.add(environment.toString()); - } else { + } else if (permittedRoles != null) { for (String role : userRoles) { for (String permission : permittedRoles) { if (role.equals(permission)) { @@ -5063,6 +5063,8 @@ public static Set extractVisibleEnvironmentsForUser(List en } } } + } else { + environmentStringSet.add(environment.toString()); } } }