summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-07 02:33:23 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-07 02:33:23 -0400
commitd706a25053cdc5d9f1ccc2c09dc3913f835c3f78 (patch)
treebb628c31b328e46d8aa7ae4c521f5f76bdfcbd38 /src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
parent6b05296e71c32abd158f354eeeaf1e135e72e6e2 (diff)
downloadSMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.tar.gz
SMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.tar.bz2
SMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.zip
enable nullable annotations for most of the SMAPI toolkit (#837)
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs')
-rw-r--r--src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
index 9998edec..6978567e 100644
--- a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
+++ b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
@@ -59,11 +57,13 @@ namespace StardewModdingAPI.Toolkit.Framework
#if SMAPI_FOR_WINDOWS
try
{
- return new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem")
+ string? result = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem")
.Get()
.Cast<ManagementObject>()
.Select(entry => entry.GetPropertyValue("Caption").ToString())
.FirstOrDefault();
+
+ return result ?? "Windows";
}
catch { }
#endif
@@ -137,7 +137,7 @@ namespace StardewModdingAPI.Toolkit.Framework
buffer = Marshal.AllocHGlobal(8192);
if (LowLevelEnvironmentUtility.uname(buffer) == 0)
{
- string os = Marshal.PtrToStringAnsi(buffer);
+ string? os = Marshal.PtrToStringAnsi(buffer);
return os == "Darwin";
}
return false;