diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-27 10:15:31 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-03-06 13:24:18 +0100 |
commit | eefbcb32ed09c8986e50e06e2ebd99b83cd67a78 (patch) | |
tree | 2cff9bb8fe1491c9e2bec50e8664d636a5b821da /lib | |
parent | 5f8c773b278e4579de4093bac6711ab456c668ae (diff) | |
download | nextcloud-server-eefbcb32ed09c8986e50e06e2ebd99b83cd67a78.tar.gz nextcloud-server-eefbcb32ed09c8986e50e06e2ebd99b83cd67a78.zip |
Fix check if theming defaults instance is available
The check in URLGenerator.php#169 and Server.php#945 are different and thus the DI container could return a \OC_Defaults object which does not provide the wanted method caising a PHP error.
Fixes #8420
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/URLGenerator.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index f7d80d41b4f..2da86e6d996 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -35,6 +35,7 @@ namespace OC; +use OCA\Theming\ThemingDefaults; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IRequest; @@ -170,7 +171,10 @@ class URLGenerator implements IURLGenerator { $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); $themingImagePath = false; if($themingEnabled) { - $themingImagePath = \OC::$server->getThemingDefaults()->replaceImagePath($app, $image); + $themingDefaults = \OC::$server->getThemingDefaults(); + if ($themingDefaults instanceof ThemingDefaults) { + $themingImagePath = $themingDefaults->replaceImagePath($app, $image); + } } if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |