From 341a898799726aadd3bd9702c7051953377dfbb2 Mon Sep 17 00:00:00 2001 From: ta264 Date: Wed, 1 May 2019 06:44:20 +0100 Subject: [PATCH] Fixed: Prevent nullRef when setting MB Artist tags --- src/TaglibSharp/Mpeg4/AppleTag.cs | 6 +++--- src/TaglibSharp/Ogg/XiphComment.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/TaglibSharp/Mpeg4/AppleTag.cs b/src/TaglibSharp/Mpeg4/AppleTag.cs index 77b21687..b6ad2428 100644 --- a/src/TaglibSharp/Mpeg4/AppleTag.cs +++ b/src/TaglibSharp/Mpeg4/AppleTag.cs @@ -483,7 +483,7 @@ public void SetDashBoxes (string meanstring, string namestring, string[] datastr // If we did find a data_box and we have an empty datastring we should // remove the entire dash box. - if (data_boxes != null && string.IsNullOrEmpty (datastring[0])) { + if (data_boxes != null && (datastring == null || string.IsNullOrEmpty (datastring[0]))) { AppleAnnotationBox dash_box = GetParentDashBox (meanstring, namestring); dash_box.ClearChildren (); ilst_box.RemoveChild (dash_box); @@ -1398,7 +1398,7 @@ public override string MusicBrainzArtistId { return artistIds == null ? null : string.Join ("/", artistIds); } set { - string[] artistIds = value.Split ('/'); + string[] artistIds = value?.Split('/') ?? null; SetDashBoxes ("com.apple.iTunes", "MusicBrainz Artist Id", artistIds); } } @@ -1455,7 +1455,7 @@ public override string MusicBrainzReleaseArtistId { return releaseArtistIds == null ? null : string.Join ("/", releaseArtistIds); } set { - string[] releaseArtistIds = value.Split ('/'); + string[] releaseArtistIds = value?.Split('/') ?? null; SetDashBoxes ("com.apple.iTunes", "MusicBrainz Album Artist Id", releaseArtistIds); } } diff --git a/src/TaglibSharp/Ogg/XiphComment.cs b/src/TaglibSharp/Ogg/XiphComment.cs index f17de063..0812e3aa 100644 --- a/src/TaglibSharp/Ogg/XiphComment.cs +++ b/src/TaglibSharp/Ogg/XiphComment.cs @@ -1219,7 +1219,7 @@ public override string MusicBrainzArtistId { return artistIds.Length == 0 ? null : string.Join ("/", artistIds); } set { - string[] artistIds = value.Split ('/'); + string[] artistIds = value?.Split('/') ?? null; SetField ("MUSICBRAINZ_ARTISTID", artistIds); } } @@ -1276,7 +1276,7 @@ public override string MusicBrainzReleaseArtistId { return releaseArtistIds.Length == 0 ? null : string.Join ("/", releaseArtistIds); } set { - string[] releaseArtistIds = value.Split ('/'); + string[] releaseArtistIds = value?.Split('/') ?? null; SetField ("MUSICBRAINZ_ALBUMARTISTID", releaseArtistIds); } }