Skip to content

Commit

Permalink
Fix concurrency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwilarg committed Nov 2, 2024
1 parent 06e1ece commit 3bb0309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.core.content.getSystemService
import com.example.euphonia.data.MusicData
import com.example.euphonia.data.Song
import com.google.gson.Gson
import kotlinx.coroutines.sync.Mutex
import java.io.File
import java.io.FileOutputStream
import java.net.URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.EditText
import android.widget.ListView
import android.widget.TextView
import androidx.activity.OnBackPressedCallback
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
Expand Down Expand Up @@ -144,7 +143,9 @@ class MusicFragment : Fragment() {
}

fun getCurrentMusics(): List<Song> {
return pView.downloaded.filter { pView.currentPlaylist == null || it.playlist == pView.currentPlaylist }
val tmp = mutableListOf<Song>()
tmp.addAll(pView.downloaded)
return tmp.filter { pView.currentPlaylist == null || it.playlist == pView.currentPlaylist }
}

fun updateList() {
Expand Down

0 comments on commit 3bb0309

Please sign in to comment.