summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/util.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-07-29 15:00:18 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-14 19:50:03 +0200
commit26342061b9b9767577a0f5eee16afd36e3b8b0b1 (patch)
tree95dda3191ca65156383773dbfcd4bfae338cd79c /lib/private/legacy/util.php
parent241fc286c78917137776d44bdf2d426d6f26f52e (diff)
downloadnextcloud-server-26342061b9b9767577a0f5eee16afd36e3b8b0b1.tar.gz
nextcloud-server-26342061b9b9767577a0f5eee16afd36e3b8b0b1.zip
Ensure the user exists before calling a method on it - fixes #24751
Diffstat (limited to 'lib/private/legacy/util.php')
-rw-r--r--lib/private/legacy/util.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 83274f82792..cea7847b3d3 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -165,6 +165,7 @@ class OC_Util {
// install storage availability wrapper, before most other wrappers
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
+ /** @var \OCP\Files\Storage $storage */
if (!$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) {
return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
}
@@ -294,12 +295,15 @@ class OC_Util {
* @return int Quota bytes
*/
public static function getUserQuota($user) {
- $userQuota = \OC::$server->getUserManager()->get($user)->getQuota();
+ $user = \OC::$server->getUserManager()->get($user);
+ if (is_null($user)) {
+ return \OCP\Files\FileInfo::SPACE_UNLIMITED;
+ }
+ $userQuota = $user->getQuota();
if($userQuota === 'none') {
return \OCP\Files\FileInfo::SPACE_UNLIMITED;
- }else{
- return OC_Helper::computerFileSize($userQuota);
}
+ return OC_Helper::computerFileSize($userQuota);
}
/**