Преглед изворни кода

Sometimes we cannot match a playlist level. Don't cause exception.

Stephen Damm пре 6 година
родитељ
комит
3076a034e9
1 измењених фајлова са 8 додато и 2 уклоњено
  1. 8 2
      SongBrowserPlugin/DataAccess/SongBrowserModel.cs

+ 8 - 2
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -324,8 +324,14 @@ namespace SongBrowserPlugin
             CurrentEditingPlaylistLevelIds = new HashSet<string>();
             CurrentEditingPlaylistLevelIds = new HashSet<string>();
             foreach (PlaylistSong ps in CurrentEditingPlaylist.songs)
             foreach (PlaylistSong ps in CurrentEditingPlaylist.songs)
             {
             {
-                CurrentEditingPlaylistLevelIds.Add(ps.level.levelID);
-            }            
+                // Sometimes we cannot match a song
+                if (ps.level == null)
+                {
+                    continue;
+                }
+
+                CurrentEditingPlaylistLevelIds.Add(ps.level.levelID);                
+            }
 
 
             // Actually sort and filter
             // Actually sort and filter
             this.ProcessSongList();
             this.ProcessSongList();