Skip to content

Commit

Permalink
Ensured closing of API on close
Browse files Browse the repository at this point in the history
Added a string null check in API requestor
  • Loading branch information
Kieran Bond committed Jan 24, 2020
1 parent 48dd476 commit 24e2ae5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MiniSpotify/MiniSpotify/Source/APIRequestor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public bool SkipSongPlayback(bool a_nextSong = true)

public string GetSongArtwork(string a_trackID)
{
if (m_spotifyWebAPI != null)
if (m_spotifyWebAPI != null && !string.IsNullOrEmpty(a_trackID))
{
return m_spotifyWebAPI.GetTrack(a_trackID).Album.Images[0].Url;
}
Expand Down
2 changes: 2 additions & 0 deletions MiniSpotify/MiniSpotify/Source/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public MainWindow()
APIRequestor.Instance.m_onAPIPolled += UpdateUI;

LocationChanged += UpdateEditWindowPosition;

Closing += (e, f) => APIRequestor.Instance.Close();
}

public void UpdateUI(FullTrack a_latestTrack = null)
Expand Down

0 comments on commit 24e2ae5

Please sign in to comment.