Skip to content

Commit

Permalink
Fixed: Prevent nullRef when setting MB Artist tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ta264 authored and Qstick committed Jan 26, 2024
1 parent 1839208 commit 84f0a18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/TaglibSharp/Mpeg4/AppleTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 (datastring == null || (data_boxes != null && string.IsNullOrEmpty (datastring[0]))) {
AppleAnnotationBox dash_box = GetParentDashBox (meanstring, namestring);
dash_box.ClearChildren ();
ilst_box.RemoveChild (dash_box);
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/TaglibSharp/Ogg/XiphComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 84f0a18

Please sign in to comment.