mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-10 16:02:05 -04:00
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:
parent
3f19f55b99
commit
eb571031ba
@ -2236,7 +2236,7 @@ abstract class CoreReaderFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setActionAndStartTTSService(action: String, isPauseTTS: Boolean = false) {
|
private fun setActionAndStartTTSService(action: String, isPauseTTS: Boolean = false) {
|
||||||
requireActivity().startService(
|
activity?.startService(
|
||||||
createReadAloudIntent(action, isPauseTTS)
|
createReadAloudIntent(action, isPauseTTS)
|
||||||
).also {
|
).also {
|
||||||
isReadAloudServiceRunning = action == ACTION_PAUSE_OR_RESUME_TTS
|
isReadAloudServiceRunning = action == ACTION_PAUSE_OR_RESUME_TTS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user