diff --git a/components/org.wso2.carbon.identity.organization.management.service/src/main/java/org/wso2/carbon/identity/organization/management/service/util/OrganizationManagementUtil.java b/components/org.wso2.carbon.identity.organization.management.service/src/main/java/org/wso2/carbon/identity/organization/management/service/util/OrganizationManagementUtil.java index 6a2c5986..c50fe894 100644 --- a/components/org.wso2.carbon.identity.organization.management.service/src/main/java/org/wso2/carbon/identity/organization/management/service/util/OrganizationManagementUtil.java +++ b/components/org.wso2.carbon.identity.organization.management.service/src/main/java/org/wso2/carbon/identity/organization/management/service/util/OrganizationManagementUtil.java @@ -84,6 +84,10 @@ public static boolean isOrganization(int tenantId) throws OrganizationManagement OrganizationManager organizationManager = OrganizationManagementDataHolder.getInstance() .getOrganizationManager(); int organizationDepth = organizationManager.getOrganizationDepthInHierarchy(organizationUUID); + + if (organizationDepth == -1) { + return false; + } return organizationDepth >= Utils.getSubOrgStartLevel(); } }