Fix crash when data.json doesn't exist

This commit is contained in:
powermaker450 2024-08-21 03:04:23 -04:00
parent ed9a4cb146
commit 159ef008de
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@
"main": "./dist/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"clean": "rm -rf ./dist ./persist",
"clean": "rm -rf ./dist",
"build": "pnpm clean && tsc -p .",
"start": "node ./dist/main.js",
"clean-start": "pnpm build && pnpm start"

View file

@ -9,7 +9,7 @@ export function checkFile(
const fullPath = dir + file;
let final: ServerSideReview[];
if (fs.existsSync(dir)) {
if (fs.existsSync(fullPath)) {
const data = fs.readFileSync(fullPath, encoding);
final = !data.toString().trim() ? [] : JSON.parse(data.toString());