Filter out invalid/broken characters

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

View File

@ -1360,6 +1360,12 @@ app.post("/getcharacters", jsonParser, function (request, response) {
let processingPromises = pngFiles.map((file, index) => processCharacter(file, index)); let processingPromises = pngFiles.map((file, index) => processCharacter(file, index));
await Promise.all(processingPromises); performance.mark('B'); 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)); response.send(JSON.stringify(characters));
}); });
}); });