Verify the getResponse returns a ResponseInterface

Can also return `null` as per PHPDoc. Regression added by 97f5c095f4

Fixes https://github.com/owncloud/core/issues/23145
This commit is contained in:
Lukas Reschke 2016-03-12 22:45:07 +01:00
parent 5862a067d9
commit d43051f7de
1 changed files with 3 additions and 1 deletions

View File

@ -34,6 +34,7 @@ namespace OC\Files\Storage;
use Exception;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Message\ResponseInterface;
use OC\Files\Filesystem;
use OC\Files\Stream\Close;
use Icewind\Streams\IteratorDirectory;
@ -351,7 +352,8 @@ class DAV extends Common {
'stream' => true
]);
} catch (RequestException $e) {
if ($e->getResponse()->getStatusCode() === 404) {
if ($e->getResponse() instanceof ResponseInterface
&& $e->getResponse()->getStatusCode() === 404) {
return false;
} else {
throw $e;