Skip to content

Commit

Permalink
fix: crash onDestroy when rotating
Browse files Browse the repository at this point in the history
  • Loading branch information
Malopieds committed Aug 26, 2024
1 parent db208c5 commit e2f9800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/java/com/zionhuang/music/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class MainActivity : ComponentActivity() {

override fun onDestroy() {
super.onDestroy()
if (dataStore.get(StopMusicOnTaskClearKey, false) && playerConnection?.isPlaying?.value == true) {
if (dataStore.get(StopMusicOnTaskClearKey, false) && playerConnection?.isPlaying?.value == true && isFinishing) {
stopService(Intent(this, MusicService::class.java))
unbindService(serviceConnection)
playerConnection = null
Expand Down

0 comments on commit e2f9800

Please sign in to comment.