fix nullability warnings

This commit is contained in:
Jesse Plamondon-Willard 2022-10-09 14:34:31 -04:00
parent 8dc12fd01c
commit d0704ef6f0
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 3 additions and 3 deletions

View File

@ -382,11 +382,11 @@ namespace SMAPI.Tests.Utilities
{ {
// act // act
string json = JsonConvert.SerializeObject(new SemanticVersion(versionStr)); string json = JsonConvert.SerializeObject(new SemanticVersion(versionStr));
SemanticVersion after = JsonConvert.DeserializeObject<SemanticVersion>(json); SemanticVersion? after = JsonConvert.DeserializeObject<SemanticVersion>(json);
// assert // assert
Assert.IsNotNull(after, "The semantic version after deserialization is unexpectedly null."); Assert.IsNotNull(after, "The semantic version after deserialization is unexpectedly null.");
Assert.AreEqual(versionStr, after.ToString(), "The semantic version after deserialization doesn't match the input version."); Assert.AreEqual(versionStr, after!.ToString(), "The semantic version after deserialization doesn't match the input version.");
} }

View File

@ -361,7 +361,7 @@ else if (log?.IsValid == true)
ContentPacks: contentPacks?.TryGetValue(mod.Name, out LogModInfo[]? contentPackList) == true ? contentPackList : Array.Empty<LogModInfo>() ContentPacks: contentPacks?.TryGetValue(mod.Name, out LogModInfo[]? contentPackList) == true ? contentPackList : Array.Empty<LogModInfo>()
)) ))
.ToList(); .ToList();
if (contentPacks?.TryGetValue("", out LogModInfo[] invalidPacks) == true) if (contentPacks?.TryGetValue("", out LogModInfo[]? invalidPacks) == true)
{ {
modsWithContentPacks.Add(( modsWithContentPacks.Add((
Mod: new LogModInfo(ModType.CodeMod, "<invalid content packs>", "", "", ""), Mod: new LogModInfo(ModType.CodeMod, "<invalid content packs>", "", "", ""),