Fixed crashes occurring in Version 3.8.1 when opening ZIM files.

* A user provided logs indicating that, during the attempt to open ZIM files, a crash occurred when stopping the TTS service. The logs revealed that, in the absence of any activity to stop the service, using `requireActivity()` resulted in an error and application crash. To address this issue, we replaced `requireActivity()` with `activity`. Now, if there is no activity present, using `activity` avoids the error that would lead to a crash.
This commit is contained in:
MohitMaliFtechiz 2024-01-19 17:01:43 +05:30
parent 3f19f55b99
commit eb571031ba

View File

@ -2236,7 +2236,7 @@ abstract class CoreReaderFragment :
}
private fun setActionAndStartTTSService(action: String, isPauseTTS: Boolean = false) {
requireActivity().startService(
activity?.startService(
createReadAloudIntent(action, isPauseTTS)
).also {
isReadAloudServiceRunning = action == ACTION_PAUSE_OR_RESUME_TTS