From 71a532fc4d45fafa66ce748e1296f03f57c2ea75 Mon Sep 17 00:00:00 2001
From: Florin Peter <github@florin-peter.de>
Date: Tue, 28 May 2013 20:50:14 +0200
Subject: [PATCH] fixed if fopen returns false typically on external storage

---
 apps/files_encryption/lib/util.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 48485cf2e8..2452f4c6ae 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -541,7 +541,7 @@ class Util {
 		// we only need 24 byte from the last chunk
 		$data = '';
 		$handle = $this->view->fopen($path, 'r');
-		if (!fseek($handle, -24, SEEK_END)) {
+		if (is_resource($handle) && !fseek($handle, -24, SEEK_END)) {
 			$data = fgets($handle);
 		}
 
-- 
GitLab