This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tenant.git


The following commit(s) were added to refs/heads/master by this push:
     new 8085391  SLING-7880 Avoid NPE when adapting to Tenant for a system 
users
8085391 is described below

commit 80853919ca46788370ed98cce593345fad19d458
Author: sseifert <[email protected]>
AuthorDate: Sun Sep 2 11:20:46 2018 +0200

    SLING-7880 Avoid NPE when adapting to Tenant for a system users
---
 .../apache/sling/tenant/internal/TenantAdapterFactory.java   | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java 
b/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
index 1090ac1..f438a79 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
@@ -119,11 +119,13 @@ class TenantAdapterFactory implements AdapterFactory {
                try {
                        Authorizable authorizable = jrSession.getUserManager()
                                        .getAuthorizable(userID);
-                       String userHome = authorizable.getPath();
-
-                       // tries to get tenant information from user home
-                       // i.e. /home/users/tenant1/a/admin
-                       return getAdapter(userHome, type);
+                       if (authorizable != null) {
+                               String userHome = authorizable.getPath();
+    
+                               // tries to get tenant information from user 
home
+                               // i.e. /home/users/tenant1/a/admin
+                               return getAdapter(userHome, type);
+                       }
                } catch (Exception e) {
                        log.error("can not get user from session", e);
                }

Reply via email to