From cbe93fbf8f4d9ffca88a4bff4849c406ac64e13a Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Mon, 14 Dec 2020 17:20:11 +0530 Subject: [PATCH] Fixed crash on first launch --- .../kiwix/kiwixmobile/custom/main/CustomReaderFragment.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomReaderFragment.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomReaderFragment.kt index 6c0b3ca4a..4a7564526 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomReaderFragment.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomReaderFragment.kt @@ -66,7 +66,7 @@ class CustomReaderFragment : CoreReaderFragment() { @Inject lateinit var customFileValidator: CustomFileValidator @Inject lateinit var dialogShower: DialogShower - + private var navFromReaderToDownload: Boolean = true override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) if (enforcedLanguage()) { @@ -157,7 +157,10 @@ class CustomReaderFragment : CoreReaderFragment() { ) { requestPermissions(arrayOf(READ_EXTERNAL_STORAGE), REQUEST_READ_FOR_OBB) } else { - findNavController().navigate(actionCustomReaderToCustomDownload()) + if (navFromReaderToDownload) { + findNavController().navigate(actionCustomReaderToCustomDownload()) + navFromReaderToDownload = false + } } } )