فهرست منبع

added logic to check that params is populated and is an instance of OCFile. Added log when there is no preview and no remote id.

Signed-off-by: camillo-positano <camillo.positano@hotmail.it>
camillo-positano 10 ماه پیش
والد
کامیت
d42198a96f
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

+ 6 - 1
app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

@@ -286,8 +286,12 @@ public final class ThumbnailsCacheManager {
         protected Bitmap doInBackground(Object... params) {
             Bitmap thumbnail;
 
-            file = (OCFile) params[0];
+            if (params == null || params.length == 0 || !(params[0] instanceof OCFile)) {
+                Log_OC.d(TAG, "Downloaded file is null or is not an instance of OCFile");
+                return null;
+            }
 
+            file = (OCFile) params[0];
 
             if (file.getRemoteId() != null || file.isPreviewAvailable()) {
                 // Thumbnail in cache?
@@ -335,6 +339,7 @@ public final class ThumbnailsCacheManager {
                 }
             }
 
+            Log_OC.d(TAG, "File cannot be previewed");
             return null;
         }