From 02bc49a25912b73c6f9de1f199e66c567a5d33ec Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 7 Feb 2020 20:18:06 +0100 Subject: [PATCH] avoid fetching files at a destroyed MainActivity --- .../simplemobiletools/gallery/pro/activities/MainActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index b61f08f97..a2c193d49 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -899,7 +899,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { try { for (directory in dirs) { - if (mShouldStopFetching) { + if (mShouldStopFetching || isDestroyed || isFinishing) { return } @@ -972,7 +972,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { // check the remaining folders which were not cached at all yet for (folder in foldersToScan) { - if (mShouldStopFetching) { + if (mShouldStopFetching || isDestroyed || isFinishing) { return }