Explorar el Código

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

Stephen Damm hace 6 años
padre
commit
3076a034e9
Se han modificado 1 ficheros con 8 adiciones y 2 borrados
  1. 8 2
      SongBrowserPlugin/DataAccess/SongBrowserModel.cs

+ 8 - 2
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -324,8 +324,14 @@ namespace SongBrowserPlugin
             CurrentEditingPlaylistLevelIds = new HashSet<string>();
             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
             this.ProcessSongList();