From 8fd41cc5870a7ec206e808f5cdfd75c6c6b43a21 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 26 Mar 2016 22:12:55 +0100 Subject: [PATCH] Fix broken bot databases --- ArchiSteamFarm/Bot.cs | 9 +++++++-- ArchiSteamFarm/BotDatabase.cs | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 61f0810bf..0e0529e39 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -133,7 +133,7 @@ namespace ArchiSteamFarm { BotConfig = BotConfig.Load(botPath + ".json"); if (BotConfig == null) { - Logging.LogGenericError("Your config for this bot instance is invalid, it won't run!", botName); + Logging.LogGenericError("Your bot config is invalid, refusing to start this bot instance!", botName); return; } @@ -162,6 +162,12 @@ namespace ArchiSteamFarm { return; } + BotDatabase = BotDatabase.Load(botPath + ".db"); + if (BotDatabase == null) { + Logging.LogGenericError("Bot database could not be loaded, refusing to start this bot instance!", botName); + return; + } + bool alreadyExists; lock (Bots) { alreadyExists = Bots.ContainsKey(botName); @@ -174,7 +180,6 @@ namespace ArchiSteamFarm { return; } - BotDatabase = BotDatabase.Load(botPath + ".db"); SentryFile = botPath + ".bin"; if (BotDatabase.SteamGuardAccount == null) { diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index 1abf90a29..dad5c61d5 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -78,6 +78,10 @@ namespace ArchiSteamFarm { return null; } + if (botDatabase == null) { + return null; + } + botDatabase.FilePath = filePath; return botDatabase; }