Assert on invalid json being saved

This commit is contained in:
JustArchi
2017-03-15 08:33:38 +01:00
parent 7ebc134ba0
commit 9f1df5de80
2 changed files with 10 additions and 0 deletions

View File

@@ -115,6 +115,11 @@ namespace ArchiSteamFarm {
return;
}
// This call verifies if JSON is alright
// We don't wrap it in try catch as it should always be the case
// And if it's not, we want to know about it (in a crash) and correc itt in future version
JsonConvert.DeserializeObject<BotDatabase>(json);
lock (FileLock) {
for (byte i = 0; i < 5; i++) {
try {

View File

@@ -116,6 +116,11 @@ namespace ArchiSteamFarm {
return;
}
// This call verifies if JSON is alright
// We don't wrap it in try catch as it should always be the case
// And if it's not, we want to know about it (in a crash) and correc itt in future version
JsonConvert.DeserializeObject<GlobalDatabase>(json);
lock (FileLock) {
for (byte i = 0; i < 5; i++) {
try {