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/Compression | |
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/Compression')
-rw-r--r-- | src/SMAPI.Web/Framework/Compression/GzipHelper.cs | 9 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/Compression/IGzipHelper.cs | 5 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/SMAPI.Web/Framework/Compression/GzipHelper.cs b/src/SMAPI.Web/Framework/Compression/GzipHelper.cs index 843b7735..e7a2df13 100644 --- a/src/SMAPI.Web/Framework/Compression/GzipHelper.cs +++ b/src/SMAPI.Web/Framework/Compression/GzipHelper.cs @@ -1,6 +1,5 @@ -#nullable disable - using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.IO.Compression; using System.Text; @@ -53,8 +52,12 @@ namespace StardewModdingAPI.Web.Framework.Compression /// <summary>Decompress a string.</summary> /// <param name="rawText">The compressed text.</param> /// <remarks>Derived from <a href="https://stackoverflow.com/a/17993002/262123"/>.</remarks> - public string DecompressString(string rawText) + [return: NotNullIfNotNull("rawText")] + public string? DecompressString(string? rawText) { + if (rawText is null) + return rawText; + // get raw bytes byte[] zipBuffer; try diff --git a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs index e1ec9b67..ef2d5696 100644 --- a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs +++ b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs @@ -1,4 +1,4 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Web.Framework.Compression { @@ -14,6 +14,7 @@ namespace StardewModdingAPI.Web.Framework.Compression /// <summary>Decompress a string.</summary> /// <param name="rawText">The compressed text.</param> - string DecompressString(string rawText); + [return: NotNullIfNotNull("rawText")] + string? DecompressString(string? rawText); } } |