mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixed the issue where opening a random article caused the application to crash.
* The issue occurred in the Play Store variant, specifically with the copy/move functionality for ZIM files. After copying or moving a ZIM file, the application attempts to open it in the reader. However, if the application tries to open a split ZIM file with only one chunk, it throws an error indicating that the file is not a valid ZIM file (which is expected, as not all ZIM chunks have been copied/moved). When this error occurs, the menu buttons remain enabled, allowing the user to interact with them. If the user then attempts to open a random article, the application enters an infinite loop and crashes. To resolve this, we now disable the menu controls whenever an error occurs while opening a ZIM file, preventing the user from using them in such scenarios.
This commit is contained in:
parent
1791911f13
commit
c60ea98b73
@ -1735,6 +1735,10 @@ abstract class CoreReaderFragment :
|
|||||||
mainMenu?.onFileOpened(urlIsValid())
|
mainMenu?.onFileOpened(urlIsValid())
|
||||||
setUpBookmarks(zimFileReader)
|
setUpBookmarks(zimFileReader)
|
||||||
} ?: kotlin.run {
|
} ?: kotlin.run {
|
||||||
|
// If the ZIM file is not opened properly (especially for ZIM chunks), exit the book to
|
||||||
|
// disable all controls for this ZIM file. This prevents potential crashes.
|
||||||
|
// See issue #4161 for more details.
|
||||||
|
exitBook()
|
||||||
requireActivity().toast(R.string.error_file_invalid, Toast.LENGTH_LONG)
|
requireActivity().toast(R.string.error_file_invalid, Toast.LENGTH_LONG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user