Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-06-19 16:56:46 +0300
committerJulius Härtl <jus@bitgrid.net>2020-06-19 16:56:46 +0300
commit5587944955eacbded8692805ad953209de7baace (patch)
tree346bdcecc28ff174d5b1f3f7c0d1d6828ba25120 /lib
parentce3801d79d964a30c494329d203ef60ef14cc690 (diff)
Catch query exception and only add listener if the LoadViewer class is available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 9eebcb18..07485aa7 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -39,6 +39,7 @@ use OCA\Richdocuments\Service\FederationService;
use OCA\Richdocuments\WOPI\DiscoveryManager;
use OCA\Viewer\Event\LoadViewer;
use OCP\AppFramework\App;
+use OCP\AppFramework\QueryException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IPreview;
@@ -63,11 +64,16 @@ class Application extends App {
public function __construct(array $urlParams = array()) {
parent::__construct(self::APPNAME, $urlParams);
- /** @var IEventDispatcher $eventDispatcher */
- $eventDispatcher = $this->getContainer()->getServer()->query(IEventDispatcher::class);
- $eventDispatcher->addListener(LoadViewer::class, function () {
- \OCP\Util::addScript('richdocuments', 'viewer');
- });
+ try {
+ /** @var IEventDispatcher $eventDispatcher */
+ $eventDispatcher = $this->getContainer()->getServer()->query(IEventDispatcher::class);
+ if (class_exists(LoadViewer::class)) {
+ $eventDispatcher->addListener(LoadViewer::class, function () {
+ \OCP\Util::addScript('richdocuments', 'viewer');
+ });
+ }
+ } catch (QueryException $e) {
+ }
$this->getContainer()->registerCapability(Capabilities::class);
}