From bc56b8ac8c8b0062fa9c38511a8cbeecff25ad3a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Thu, 17 Jan 2019 16:14:47 +0100 Subject: [PATCH] Avoid potential NRE during shutdown --- ArchiSteamFarm/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index 174a32e0b..3c389d003 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -381,7 +381,7 @@ namespace ArchiSteamFarm { // Ensure that IPC is stopped before we finalize shutdown sequence await ArchiKestrel.Stop().ConfigureAwait(false); - if (Bot.Bots.Count > 0) { + if (Bot.Bots?.Count > 0) { // Stop() function can block due to SK2 sockets, don't forget a maximum delay await Task.WhenAny(Utilities.InParallel(Bot.Bots.Values.Select(bot => Task.Run(() => bot.Stop(true)))), Task.Delay(Bot.Bots.Count * WebBrowser.MaxTries * 1000)).ConfigureAwait(false);