Fix constructor of Template.class.php
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 10 Jun 2014 15:37:07 +0000 (17:37 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 10 Jun 2014 17:17:16 +0000 (19:17 +0200)
wcfsetup/install/files/lib/data/template/Template.class.php

index e3bdbcc61a6cfa7b852f3e89f4dc4ed19f1c3a7b..604b802ae69f456d417fb58be0904d3aa6efefd2 100644 (file)
@@ -46,18 +46,20 @@ class Template extends DatabaseObject {
                        $statement->execute(array($id));
                        $row = $statement->fetchArray();
                        
-                       // get relative directory of the template the application
-                       // belongs to
-                       if ($row['application'] != 'wcf') {
-                               $application = ApplicationHandler::getInstance()->getApplication($row['application']);
+                       if ($row !== false) {
+                               // get relative directory of the template the application
+                               // belongs to
+                               if ($row['application'] != 'wcf') {
+                                       $application = ApplicationHandler::getInstance()->getApplication($row['application']);
+                               }
+                               else {
+                                       $application = ApplicationHandler::getInstance()->getWCF();
+                               }
+                               $row['packageDir'] = PackageCache::getInstance()->getPackage($application->packageID)->packageDir;
                        }
                        else {
-                               $application = ApplicationHandler::getInstance()->getWCF();
+                               $row = array();
                        }
-                       $row['packageDir'] = PackageCache::getInstance()->getPackage($application->packageID)->packageDir;
-                       
-                       // enforce data type 'array'
-                       if ($row === false) $row = array();
                }
                else if ($object !== null) {
                        $row = $object->data;