Skip to content

Commit 02cf076

Browse files
alperozturk96backportbot[bot]
authored andcommitted
check job cancellation via try catch
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent c4ca800 commit 02cf076

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/com/nextcloud/client/jobs/gallery/GalleryImageGenerationJob.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ class GalleryImageGenerationJob(private val user: User, private val storageManag
108108
}
109109

110110
setThumbnail(bitmap, file, imageView, newImage, listener)
111-
} catch (e: Exception) {
112-
Log_OC.e(TAG, "gallery image generation job: ", e)
111+
} catch (_: Exception) {
113112
withContext(Dispatchers.Main) {
114113
listener.onError()
115114
}

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,15 @@ class OCFileListDelegate(
411411
showShareAvatar = bool
412412
}
413413

414+
@Suppress("TooGenericExceptionCaught")
414415
fun cleanup() {
415416
ioScope.cancel()
416417

417-
GalleryImageGenerationJob.cancelAllActiveJobs()
418+
try {
419+
GalleryImageGenerationJob.cancelAllActiveJobs()
420+
} catch (e: Exception) {
421+
Log_OC.e(TAG, "exception: ", e)
422+
}
418423

419424
// cancel async tasks from ThumbnailsCacheManager
420425
cancelAllPendingTasks()

0 commit comments

Comments
 (0)