Call base constructor while creating BotDatabase

This is a severe edge case. We forgot to call base constructor during creating BotDatabase, which is funny because it wasn't the case for ASF database. This caused event listeners to not be recorded, and therefore changes not being saved. Normally this bug entirely slipped through because on first login, login key is normally saved into the database, and that part always generated the file, with or without the listeners. However, if somebody has UseLoginKeys: false, and doesn't set up ASF 2FA for the bot, and bot database doesn't exist, it won't get created on changes to other bot database properties, that is: farming blacklist, farming priority queue, match actively blacklist and trading blacklist.

Wow, this one is old, I don't know if we didn't have this bug since first version of ASF or something.
This commit is contained in:
Archi
2022-12-28 00:26:14 +01:00
parent 74ef78b217
commit 75c62b6de0

View File

@@ -94,7 +94,7 @@ internal sealed class BotDatabase : SerializableFile {
[JsonProperty($"_{nameof(MobileAuthenticator)}")]
private MobileAuthenticator? BackingMobileAuthenticator;
private BotDatabase(string filePath) {
private BotDatabase(string filePath) : this() {
if (string.IsNullOrEmpty(filePath)) {
throw new ArgumentNullException(nameof(filePath));
}