diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-16 22:06:57 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-16 22:06:57 +0100 |
commit | 569b8413d46e7f4132793f4bc34485233b2cf60f (patch) | |
tree | 8eeb8801fb6dafc0407a943a46e15e7799e4e6cc /lib | |
parent | cdfffe7bda61847f39cf956e00b69d657570e69a (diff) | |
download | nextcloud-server-569b8413d46e7f4132793f4bc34485233b2cf60f.tar.gz nextcloud-server-569b8413d46e7f4132793f4bc34485233b2cf60f.zip |
Add extra check so we don't error out on type
json_decode can return false if we have invalid data.
In that case just assume there was nothing cached
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/OCS/DiscoveryService.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index 53b4d13e797..016331e908f 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -65,7 +65,10 @@ class DiscoveryService implements IDiscoveryService { // Check the cache first $cacheData = $this->cache->get($remote . '#' . $service); if($cacheData) { - return json_decode($cacheData, true); + $data = json_decode($cacheData, true); + if (\is_array($data)) { + return $data; + } } $discoveredServices = []; |