Przeglądaj źródła

Fix favorites playlist matching with newly added items.
Fix playlist loading if completely unmatchable songs are in it.

Stephen Damm 5 lat temu
rodzic
commit
4736944ee1
1 zmienionych plików z 13 dodań i 4 usunięć
  1. 13 4
      SongBrowserPlugin/DataAccess/SongBrowserModel.cs

+ 13 - 4
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -280,12 +280,21 @@ namespace SongBrowser
             foreach (PlaylistSong ps in CurrentEditingPlaylist.songs)
             {
                 // Sometimes we cannot match a song
-                if (ps.level == null)
+                string levelId = null;
+                if (ps.level != null)
+                {
+                    levelId = ps.level.levelID;
+                }
+                else if (!String.IsNullOrEmpty(ps.levelId))
+                {
+                    levelId = ps.levelId;
+                }
+                else
                 {
                     continue;
                 }
 
-                CurrentEditingPlaylistLevelIds.Add(ps.level.levelID);
+                CurrentEditingPlaylistLevelIds.Add(levelId);
             }
 
             // Signal complete
@@ -646,9 +655,9 @@ namespace SongBrowser
             List<IPreviewBeatmapLevel> songList = new List<IPreviewBeatmapLevel>();
             foreach (PlaylistSong ps in this.CurrentPlaylist.songs)
             {
-                if (ps.level != null)
+                if (ps.level != null && levelDict.ContainsKey(ps.level.levelID))
                 {
-                    songList.Add(levelDict[ps.level.levelID] as IPreviewBeatmapLevel);
+                    songList.Add(levelDict[ps.level.levelID]);
                 }
                 else
                 {