Avoid attempting to save database without a FilePath

This commit is contained in:
JustArchi
2020-12-01 23:32:00 +01:00
parent a0dc81804e
commit 93582696fe
2 changed files with 14 additions and 2 deletions

View File

@@ -198,7 +198,13 @@ namespace ArchiSteamFarm {
Utilities.InBackground(Save);
}
private async void OnObjectModified(object? sender, EventArgs e) => await Save().ConfigureAwait(false);
private async void OnObjectModified(object? sender, EventArgs e) {
if (string.IsNullOrEmpty(FilePath)) {
return;
}
await Save().ConfigureAwait(false);
}
// ReSharper disable UnusedMember.Global
public bool ShouldSerializeBackingLoginKey() => !string.IsNullOrEmpty(BackingLoginKey);

View File

@@ -221,7 +221,13 @@ namespace ArchiSteamFarm {
}
}
private async void OnObjectModified(object? sender, EventArgs e) => await Save().ConfigureAwait(false);
private async void OnObjectModified(object? sender, EventArgs e) {
if (string.IsNullOrEmpty(FilePath)) {
return;
}
await Save().ConfigureAwait(false);
}
// ReSharper disable UnusedMember.Global
public bool ShouldSerializeBackingCellID() => BackingCellID != 0;