From 89df46fe56d5bbc30da95f160acdf12c19734075 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 10 Jun 2014 17:37:07 +0200 Subject: [PATCH] Fix constructor of Template.class.php --- .../lib/data/template/Template.class.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/data/template/Template.class.php b/wcfsetup/install/files/lib/data/template/Template.class.php index e3bdbcc61a..604b802ae6 100644 --- a/wcfsetup/install/files/lib/data/template/Template.class.php +++ b/wcfsetup/install/files/lib/data/template/Template.class.php @@ -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; -- 2.20.1