prevent problems with getApplicationByName
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 27 Jul 2017 13:14:33 +0000 (15:14 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 27 Jul 2017 14:24:11 +0000 (16:24 +0200)
Change-Id: Iee30e4324f2f030ea884c2d484c02a5b3e5895d4
Reviewed-on: http://gerrit.tine20.com/customers/5344
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Application.php

index c44d18c..bab16ac 100644 (file)
@@ -125,7 +125,12 @@ class Tinebase_Application
             throw new Tinebase_Exception_InvalidArgument('$_applicationName can not be empty / has to be string.');
         }
 
-        $application = $this->getApplications()->find('name', $_applicationName);
+        $applications = $this->getApplications();
+        if ($applications) {
+            $application = $applications->find('name', $_applicationName);
+        } else {
+            $application = false;
+        }
         
         if (!$application) {
             throw new Tinebase_Exception_NotFound("Application $_applicationName not found.");