File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader
core/src/main/java/org/kiwix/kiwixmobile/core/main Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -257,9 +257,10 @@ class KiwixReaderFragment : CoreReaderFragment() {
257257 when (restoreOrigin) {
258258 FromExternalLaunch -> {
259259 coreReaderLifeCycleScope?.launch {
260+ if (! isAdded) return @launch
260261 val settings =
261- requireActivity() .getSharedPreferences(SharedPreferenceUtil .PREF_KIWIX_MOBILE , 0 )
262- val zimReaderSource = fromDatabaseValue(settings.getString(TAG_CURRENT_FILE , null ))
262+ activity? .getSharedPreferences(SharedPreferenceUtil .PREF_KIWIX_MOBILE , 0 )
263+ val zimReaderSource = fromDatabaseValue(settings? .getString(TAG_CURRENT_FILE , null ))
263264 if (zimReaderSource?.canOpenInLibkiwix() == true ) {
264265 if (zimReaderContainer?.zimReaderSource == null ) {
265266 openZimFile(zimReaderSource, isFromManageExternalLaunch = true )
Original file line number Diff line number Diff line change @@ -1220,6 +1220,7 @@ abstract class CoreReaderFragment :
12201220 override fun onDestroyView () {
12211221 super .onDestroyView()
12221222 try {
1223+ coreReaderLifeCycleScope?.cancel()
12231224 readerLifeCycleScope?.cancel()
12241225 readerLifeCycleScope = null
12251226 } catch (ignore: Exception ) {
You can’t perform that action at this time.
0 commit comments