diff --git a/repository/googledocs/lib.php b/repository/googledocs/lib.php index 3520254d96b..1ce0e1bdc15 100644 --- a/repository/googledocs/lib.php +++ b/repository/googledocs/lib.php @@ -588,7 +588,7 @@ class repository_googledocs extends repository { $storedfile->get_filepath(), $storedfile->get_filename()); - if (empty($options['offline']) && $info->is_writable()) { + if (empty($options['offline']) && !empty($info) && $info->is_writable()) { // Add the current user as an OAuth writer. $systemauth = \core\oauth2\api::get_system_oauth_client($this->issuer); diff --git a/repository/onedrive/lib.php b/repository/onedrive/lib.php index 5e79d9bca96..73118a34230 100644 --- a/repository/onedrive/lib.php +++ b/repository/onedrive/lib.php @@ -537,7 +537,7 @@ class repository_onedrive extends repository { $storedfile->get_filepath(), $storedfile->get_filename()); - if (empty($options['offline']) && $info->is_writable()) { + if (empty($options['offline']) && !empty($info) && $info->is_writable()) { // Add the current user as an OAuth writer. $systemauth = \core\oauth2\api::get_system_oauth_client($this->issuer);