Skip to content

Commit

Permalink
fix: indices error while removing items from playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Dec 5, 2024
1 parent 1889967 commit 95ce065
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/core/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class NamidaOnTaps {

final Map<TrackWithDate, int> twdAndIndexes = {};
tracksWithDates.loop((twd) {
twdAndIndexes[twd] = playlist.tracks.indexOf(twd);
final index = playlist.tracks.indexOf(twd);
if (index > -1) twdAndIndexes[twd] = index;
});

await PlaylistController.inst.removeTracksFromPlaylist(playlist, twdAndIndexes.values.toList());
Expand Down
3 changes: 2 additions & 1 deletion lib/youtube/yt_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ class YTUtils {

final Map<YoutubeID, int> twdAndIndexes = {};
videosToDelete.loop((twd) {
twdAndIndexes[twd] = playlist.tracks.indexOf(twd);
final index = playlist.tracks.indexOf(twd);
if (index > -1) twdAndIndexes[twd] = index;
});

await YoutubePlaylistController.inst.removeTracksFromPlaylist(playlist, twdAndIndexes.values.toList());
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: namida
description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter
publish_to: "none"
version: 4.7.86-beta+241201220
version: 4.7.87-beta+241201230

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down

0 comments on commit 95ce065

Please sign in to comment.