Fixes #788 - Fall back to config theme when db theme fails.

This commit is contained in:
Samuel Georges 2014-11-23 03:40:04 +11:00
parent 846a312765
commit 001e86456d
2 changed files with 4 additions and 4 deletions

View File

@ -95,8 +95,8 @@ class Theme
*/
public static function exists($dirName)
{
$theme = new static;
$path = $theme->getPath($dirName);
$theme = static::load($dirName);
$path = $theme->getPath();
return File::isDirectory($path);
}
@ -133,7 +133,7 @@ class Theme
->pluck('value')
;
if ($dbResult !== null) {
if ($dbResult !== null && static::exists($dbResult)) {
$activeTheme = $dbResult;
}
}

View File

@ -6,7 +6,7 @@
<?php foreach ($themes as $index => $theme): ?>
<?php
$isLast = $index == $cnt-1;
$isActive = $activeTheme->getDirName() == $theme->getDirName();
$isActive = $activeTheme && $activeTheme->getDirName() == $theme->getDirName();
$author = $theme->getConfigValue('author');
?>
<div class="layout-row <?= $isLast ? 'last' : null ?> min-size <?= $isActive ? 'active' : null ?>">