Skip to content

Commit

Permalink
Allowed for null JSON values, which are encountered when processing a…
Browse files Browse the repository at this point in the history
…lbum data from urls for single tracks. This appears to be working well, without any adverse effects.
  • Loading branch information
ajsnyde committed Jan 18, 2017
1 parent f6affe4 commit cca782a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/BandcampDownloader/Helpers/BandcampHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public static Album GetAlbum(String htmlCode) {
// Deserialize JSON
Album album;
try {
album = JsonConvert.DeserializeObject<JsonAlbum>(albumData).ToAlbum();
var settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore
};
album = JsonConvert.DeserializeObject<JsonAlbum>(albumData, settings).ToAlbum();
} catch (Exception e) {
throw new Exception("Could not deserialize JSON data.", e);
}
Expand Down

0 comments on commit cca782a

Please sign in to comment.