Bläddra i källkod

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 månader sedan
förälder
incheckning
d42198a96f

+ 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) {
         protected Bitmap doInBackground(Object... params) {
             Bitmap thumbnail;
             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()) {
             if (file.getRemoteId() != null || file.isPreviewAvailable()) {
                 // Thumbnail in cache?
                 // Thumbnail in cache?
@@ -335,6 +339,7 @@ public final class ThumbnailsCacheManager {
                 }
                 }
             }
             }
 
 
+            Log_OC.d(TAG, "File cannot be previewed");
             return null;
             return null;
         }
         }