From a5eb9fad43775854b23248c127529d0c8d8be32f Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 23 Apr 2025 15:40:01 +0200 Subject: [PATCH] fix some null reference exceptions --- ModpackUpdater.Manager/Extensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ModpackUpdater.Manager/Extensions.cs b/ModpackUpdater.Manager/Extensions.cs index 0a0a51a..0fcee99 100644 --- a/ModpackUpdater.Manager/Extensions.cs +++ b/ModpackUpdater.Manager/Extensions.cs @@ -44,27 +44,27 @@ public static class Extensions public static string GetSourceUrl(this InstallAction @this, Version version, string? overwriteVersion = null) { if (!string.IsNullOrWhiteSpace(overwriteVersion)) - return @this.SourceUrl.Replace("{version}", overwriteVersion); + return @this.SourceUrl?.Replace("{version}", overwriteVersion); if (version is not null) - return @this.SourceUrl.Replace("{version}", version.ToString(3)); + return @this.SourceUrl?.Replace("{version}", version.ToString(3)); return @this.SourceUrl; } public static string GetInstallUrl(this ModpackConfig @this, string? overwriteRefTag = null) { if (!string.IsNullOrWhiteSpace(overwriteRefTag)) - return @this.InstallUrl.Replace("{ref}", overwriteRefTag); + return @this.InstallUrl?.Replace("{ref}", overwriteRefTag); if (!string.IsNullOrWhiteSpace(@this.RefTag)) - return @this.InstallUrl.Replace("{ref}", @this.RefTag); + return @this.InstallUrl?.Replace("{ref}", @this.RefTag); return @this.InstallUrl; } public static string GetUpdateUrl(this ModpackConfig @this, string? overwriteRefTag = null) { if (!string.IsNullOrWhiteSpace(overwriteRefTag)) - return @this.UpdateUrl.Replace("{ref}", overwriteRefTag); + return @this.UpdateUrl?.Replace("{ref}", overwriteRefTag); if (!string.IsNullOrWhiteSpace(@this.RefTag)) - return @this.UpdateUrl.Replace("{ref}", @this.RefTag); + return @this.UpdateUrl?.Replace("{ref}", @this.RefTag); return @this.UpdateUrl; } } \ No newline at end of file