Prechádzať zdrojové kódy

Do not break if last known playlist has been deleted.
Search is disabling properly.

Stephen Damm 6 rokov pred
rodič
commit
d2dae10c8f

+ 8 - 0
SongBrowserPlugin/SongBrowserModel.cs

@@ -594,6 +594,14 @@ namespace SongBrowserPlugin
 
         private void FilterPlaylist()
         {
+            // bail if no playlist, usually means the settings stored one the user then moved.
+            if (this.CurrentPlaylist == null)
+            {
+                _log.Error("Trying to load a null playlist...");
+                _filteredSongs = _originalSongs;
+                return;
+            }
+
             _log.Debug("Filtering songs for playlist: {0}", this.CurrentPlaylist);
             List<String> playlistNameListOrdered = this.CurrentPlaylist.songs.Select(x => x.songName).Distinct().ToList();
             Dictionary<String, int> songNameToIndex = playlistNameListOrdered.Select((val, index) => new { Index = index, Value = val }).ToDictionary(i => i.Value, i => i.Index);

+ 2 - 0
SongBrowserPlugin/UI/SongBrowserUI.cs

@@ -385,6 +385,8 @@ namespace SongBrowserPlugin.UI
             else
             {
                 _model.Settings.filterMode = SongFilterMode.None;
+                UpdateSongList();
+                RefreshSongList();
             }
             _model.Settings.Save();            
         }