From 146066ebca1ac942ebf130dbebb4f4dcd9401b6a Mon Sep 17 00:00:00 2001 From: fiso64 Date: Mon, 23 Dec 2024 16:20:58 +0100 Subject: [PATCH] fix album-aggregate null reference exception --- slsk-batchdl/Models/TrackListEntry.cs | 7 +++++-- slsk-batchdl/Program.cs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/slsk-batchdl/Models/TrackListEntry.cs b/slsk-batchdl/Models/TrackListEntry.cs index 68d90ee..7bd255c 100644 --- a/slsk-batchdl/Models/TrackListEntry.cs +++ b/slsk-batchdl/Models/TrackListEntry.cs @@ -12,6 +12,7 @@ namespace Models public bool needSkipExistingAfterSearch = false; public bool gotoNextAfterSearch = false; public bool enablesIndexByDefault = false; + public bool preprocessTracks = true; public string? defaultFolderName = null; public Config config = null!; @@ -47,8 +48,8 @@ namespace Models SetDefaults(); } - public TrackListEntry(List> list, Track source, bool needSourceSearch = false, bool sourceCanBeSkipped = false, - bool needSkipExistingAfterSearch = false, bool gotoNextAfterSearch = false, string? defaultFoldername = null) + public TrackListEntry(List> list, Track source, Config config, bool needSourceSearch = false, bool sourceCanBeSkipped = false, + bool needSkipExistingAfterSearch = false, bool gotoNextAfterSearch = false, string? defaultFoldername = null, bool preprocessTracks = true) { this.list = list; this.source = source; @@ -57,6 +58,8 @@ namespace Models this.needSkipExistingAfterSearch = needSkipExistingAfterSearch; this.gotoNextAfterSearch = gotoNextAfterSearch; this.defaultFolderName = defaultFoldername; + this.config = config; + this.preprocessTracks = preprocessTracks; } public void SetDefaults() diff --git a/slsk-batchdl/Program.cs b/slsk-batchdl/Program.cs index 5a95f10..1be6d82 100644 --- a/slsk-batchdl/Program.cs +++ b/slsk-batchdl/Program.cs @@ -263,7 +263,7 @@ static partial class Program var tle = trackLists[i]; var config = tle.config; - PreprocessTracks(tle); + if (tle.preprocessTracks) PreprocessTracks(tle); if (!enableParallelSearch) tle.PrintLines(); var existing = new List(); @@ -357,7 +357,7 @@ static partial class Program foreach (var item in res) { var newSource = new Track(tle.source) { Type = TrackType.Album }; - var albumTle = new TrackListEntry(item, newSource, needSourceSearch: false, sourceCanBeSkipped: true); + var albumTle = new TrackListEntry(item, newSource, config, needSourceSearch: false, sourceCanBeSkipped: true, preprocessTracks: false); albumTle.defaultFolderName = tle.defaultFolderName; trackLists.AddEntry(albumTle); }