If there is no UID do not explode accessibility javascript

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-10-22 11:26:21 +02:00
parent f7538fcc82
commit 3ac15a45ea
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 9 additions and 1 deletions

View File

@ -192,9 +192,17 @@ class AccessibilityController extends Controller {
* @return DataDownloadResponse
*/
public function getJavascript(): DataDownloadResponse {
$user = $this->userSession->getUser();
if ($user === null) {
$theme = false;
} else {
$theme = $this->config->getUserValue($user->getUID(), $this->appName, 'theme', false);
}
$responseJS = '(function() {
OCA.Accessibility = {
theme: ' . json_encode($this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false)) . ',
theme: ' . json_encode($theme) . ',
};
})();';