Fix this null warning in `GuiLuaLibrary`

This commit is contained in:
YoshiRulz 2022-02-03 20:27:18 +10:00
parent 7259a6413e
commit 45f64f62de
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#nullable enable
using System;
using System.Diagnostics.CodeAnalysis;
namespace BizHawk.Client.Common
{
@ -13,6 +14,7 @@ namespace BizHawk.Client.Common
/// <remarks>should probably centralise these enum extensions and not-extensions somewhere... --yoshi</remarks>
public static class DisplaySurfaceIDParser
{
[return: NotNullIfNotNull("str")]
public static DisplaySurfaceID? Parse(string? str) => str?.ToLowerInvariant() switch
{
null => null, // this makes it easy to cascade the "remembered" value

View File

@ -193,7 +193,7 @@ namespace BizHawk.Client.Common
Log("Surface name cannot be nil. Pass \"emucore\" to `gui.use_surface` to restore the default.");
return;
}
_rememberedSurfaceID = DisplaySurfaceIDParser.Parse(surfaceName).Value; // iff param is not null, returns not null or throws
_rememberedSurfaceID = DisplaySurfaceIDParser.Parse(surfaceName).Value;
}
public void Dispose() => APIs.Gui.Dispose();