ActionQueue: handle case of missing user object
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Aug 2017 07:13:40 +0000 (09:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Aug 2017 10:46:33 +0000 (12:46 +0200)
Change-Id: I36faa30ad068a444e0887db6781e4b81e6749635
Reviewed-on: http://gerrit.tine20.com/customers/5405
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/ActionQueue.php

index c304756..a552b49 100644 (file)
     {
         $params = func_get_args();
         $action = array_shift($params);
+        $user = Tinebase_Core::getUser();
+        if (! is_object($user)) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) Tinebase_Core::getLogger()->err(
+                __METHOD__ . '::' . __LINE__ . " Not Queueing action: '{$action}' because no valid user object found");
+            return null;
+        }
+
         $message = array(
             'action'     => $action,
-            'account_id' => Tinebase_Core::getUser()->getId(),
+            'account_id' => $user->getId(),
             'params'     => $params
         );