From afbc15db79939f576a05363a74ccdaa66134669f Mon Sep 17 00:00:00 2001 From: yairm210 Date: Tue, 15 Oct 2024 14:54:02 +0300 Subject: [PATCH] Solve ANRs due to resuming music player which is in an unplayable state --- core/src/com/unciv/ui/audio/MusicController.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/audio/MusicController.kt b/core/src/com/unciv/ui/audio/MusicController.kt index e830e9092d..e65e12ca14 100644 --- a/core/src/com/unciv/ui/audio/MusicController.kt +++ b/core/src/com/unciv/ui/audio/MusicController.kt @@ -544,7 +544,8 @@ class MusicController { */ fun resume(speedFactor: Float = 1f) { Log.debug("MusicTrackController.resume called") - if (state == ControllerState.Pause && current != null) { + if (state == ControllerState.Pause && current != null + && current!!.state.canPlay && current!!.music != null) { val fadingStep = defaultFadingStep * speedFactor.coerceIn(0.001f..1000f) current!!.startFade(MusicTrackController.State.FadeIn, fadingStep) // this may circumvent a PlaySingle, but -