if a track cannot be fetched by id, try path

This commit is contained in:
tibbi 2020-11-02 18:40:10 +01:00
parent edacc32eb6
commit ccdbf7ac63

View file

@ -153,7 +153,11 @@ class TracksActivity : SimpleActivity() {
if (mediaStoreId == 0L) {
toast(R.string.unknown_error_occurred)
} else {
val track = tracksDAO.getTrackWithMediaStoreId(mediaStoreId)
var track = tracksDAO.getTrackWithMediaStoreId(mediaStoreId)
if (track == null) {
track = RoomHelper(this).getTrackFromPath(path)
}
if (track != null) {
track.id = 0
track.playListId = playlist!!.id