diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
commit | 0b48c1748b354458059c7607415288de072b01e9 (patch) | |
tree | f63fd950f565d363414eb692be9024895cdea174 /src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs | |
parent | 9fbed0fa1f28a9b0fe0b952a78b10e2d475adb03 (diff) | |
download | SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.gz SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.bz2 SMAPI-0b48c1748b354458059c7607415288de072b01e9.zip |
enable nullable annotations in the web project & related code (#837)
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs index 5ef369d5..d351b42d 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -42,7 +40,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge /// <summary>Get update check info about a mod.</summary> /// <param name="id">The mod ID.</param> - public async Task<IModPage> GetModData(string id) + public async Task<IModPage?> GetModData(string id) { IModPage page = new GenericModPage(this.SiteKey, id); @@ -51,9 +49,9 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge return page.SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid CurseForge mod ID, must be an integer ID."); // get raw data - ModModel mod = await this.Client + ModModel? mod = await this.Client .GetAsync($"addon/{parsedId}") - .As<ModModel>(); + .As<ModModel?>(); if (mod == null) return page.SetError(RemoteModStatus.DoesNotExist, "Found no CurseForge mod with this ID."); @@ -73,7 +71,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } @@ -82,9 +80,9 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge *********/ /// <summary>Get a raw version string for a mod file, if available.</summary> /// <param name="file">The file whose version to get.</param> - private string GetRawVersion(ModFileModel file) + private string? GetRawVersion(ModFileModel file) { - Match match = this.VersionInNamePattern.Match(file.DisplayName); + Match match = this.VersionInNamePattern.Match(file.DisplayName ?? ""); if (!match.Success) match = this.VersionInNamePattern.Match(file.FileName); |