Filter out invalid/broken characters

This commit is contained in:
Cohee 2023-10-09 19:09:33 +03:00
parent c9c4f30637
commit 15c81749b8
1 changed files with 6 additions and 0 deletions

View File

@ -1350,6 +1350,12 @@ app.post("/getcharacters", jsonParser, function (request, response) {
let processingPromises = pngFiles.map((file, index) => processCharacter(file, index));
await Promise.all(processingPromises); performance.mark('B');
// Filter out invalid/broken characters
characters = Object.values(characters).filter(x => x?.name).reduce((acc, val, index) => {
acc[index] = val;
return acc;
}, {});
response.send(JSON.stringify(characters));
});
});