diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-27 10:15:31 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-02-27 10:15:31 +0100 |
commit | e2cd33adfe8735dd4048591922f55499406dec80 (patch) | |
tree | f4911a45e05f5a95019b9d13045ef1094d11dab2 /lib/private | |
parent | cd3eb80ef4e9613e16430cb4c53332ac3cdae97a (diff) | |
download | nextcloud-server-e2cd33adfe8735dd4048591922f55499406dec80.tar.gz nextcloud-server-e2cd33adfe8735dd4048591922f55499406dec80.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/private')
-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 c72c2255179..6f4f869238c 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -35,6 +35,7 @@ declare(strict_types=1); namespace OC; +use OCA\Theming\ThemingDefaults; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IRequest; @@ -168,7 +169,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")) { |