Fix bug with invalid data on disk

This commit is contained in:
Matt Isenhower 2026-02-17 21:35:21 -08:00
parent eb7aa11245
commit 60c61e6231

View File

@ -137,15 +137,13 @@ export default class FestivalUpdater extends DataUpdater
async _formatDataForWrite(data) {
// Combine this region's data with the other regions' data.
let result = null;
let result = {};
try {
result = await fs.readFile(this.getPath(this.filename));
} catch (e) {
result = JSON.parse(await fs.readFile(this.getPath(this.filename)));
} catch {
//
}
result = result ? JSON.parse(result) : {};
result[this.region] = data;
return super.formatDataForWrite(result);