From 0cbfc3e0bf625a345022c505a8355d36a5831476 Mon Sep 17 00:00:00 2001 From: maxisoft Date: Tue, 31 Oct 2023 14:41:08 +0100 Subject: [PATCH] Fix CS8603 error in ASFFreeGamesPlugin.cs This commit resolves the CS8603 error: "Possible null reference return" in the ASFFreeGamesPlugin.cs file. The error was caused by the possibility of returning a null value from the Context property. The fix involves using the null-forgiving operator (!) to assert that the _context.Value is not null. --- ASFFreeGames/ASFFreeGamesPlugin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ASFFreeGames/ASFFreeGamesPlugin.cs b/ASFFreeGames/ASFFreeGamesPlugin.cs index a9e5b99..e805835 100644 --- a/ASFFreeGames/ASFFreeGamesPlugin.cs +++ b/ASFFreeGames/ASFFreeGamesPlugin.cs @@ -31,7 +31,7 @@ internal sealed class ASFFreeGamesPlugin : IASF, IBot, IBotConnection, IBotComma private const int CollectGamesTimeout = 3 * 60 * 1000; internal static PluginContext Context { - get => _context.Value; + get => _context.Value!; private set => _context.Value = value; } @@ -169,6 +169,7 @@ private async Task RemoveBot(Bot bot) { LoggerFilter.RemoveFilters(bot); } + // ReSharper disable once UnusedMethodReturnValue.Local private async Task SaveOptions(CancellationToken cancellationToken) { if (!cancellationToken.IsCancellationRequested) { const string cmd = $"FREEGAMES {FreeGamesCommand.SaveOptionsInternalCommandString}";