[fix] Fixed a bug where new users showed "Your save file is corrupted… (#183)

…" due to a null exception

# PR Checklist
- [-] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [-] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions?
- [-] Did you added a type def?

# Description
- [fix] Fixed a bug where new users always showed "Your save file is
corrupted" once due to a null exception
This commit is contained in:
kwaroran
2023-06-26 17:59:51 +09:00
committed by GitHub

View File

@@ -310,7 +310,8 @@ export async function loadData() {
else{
let gotStorage:Uint8Array = await forageStorage.getItem('database/database.bin')
if(checkNullish(gotStorage)){
await forageStorage.setItem('database/database.bin', encodeRisuSave({}))
gotStorage = encodeRisuSave({})
await forageStorage.setItem('database/database.bin', gotStorage)
}
try {
setDatabase(