diff --git a/server/src/main/java/com/orientechnologies/orient/server/security/ODefaultServerSecurity.java b/server/src/main/java/com/orientechnologies/orient/server/security/ODefaultServerSecurity.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/com/orientechnologies/orient/server/security/ODefaultServerSecurity.java
+++ b/server/src/main/java/com/orientechnologies/orient/server/security/ODefaultServerSecurity.java
@@ -594,10 +594,12 @@ public class ODefaultServerSecurity implements OSecurityFactory, OServerLifecycl
             for (OClientConnection cc : ccm.getConnections()) {
               try {
                 ODatabaseDocumentTx ccDB = cc.getDatabase();
-                ccDB.activateOnCurrentThread();
-                if (ccDB != null && !ccDB.isClosed() && ccDB.getURL() != null) {
-                  if (ccDB.getURL().equals(dbURL)) {
-                    ccDB.reloadUser();
+                if(ccDB != null) {
+                  ccDB.activateOnCurrentThread();
+                  if (!ccDB.isClosed() && ccDB.getURL() != null) {
+                    if (ccDB.getURL().equals(dbURL)) {
+                      ccDB.reloadUser();
+                    }
                   }
                 }
               } catch (Exception ex) {
fixed null pointer in case of missing database in default security