From cca782a6debb1a0c5d5a8e9c213c0fbab3cec7a7 Mon Sep 17 00:00:00 2001 From: Addison Snyder Date: Tue, 17 Jan 2017 20:11:19 -0500 Subject: [PATCH] Allowed for null JSON values, which are encountered when processing album data from urls for single tracks. This appears to be working well, without any adverse effects. --- Sources/BandcampDownloader/Helpers/BandcampHelper.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs b/Sources/BandcampDownloader/Helpers/BandcampHelper.cs index 06127075..e78612f7 100644 --- a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs +++ b/Sources/BandcampDownloader/Helpers/BandcampHelper.cs @@ -27,7 +27,12 @@ public static Album GetAlbum(String htmlCode) { // Deserialize JSON Album album; try { - album = JsonConvert.DeserializeObject(albumData).ToAlbum(); + var settings = new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + MissingMemberHandling = MissingMemberHandling.Ignore + }; + album = JsonConvert.DeserializeObject(albumData, settings).ToAlbum(); } catch (Exception e) { throw new Exception("Could not deserialize JSON data.", e); }