Error handling for sorting

Related to #9.
master 2.2.4
Matheus Clemente 2024-03-01 20:03:10 -03:00
parent 03853f55b9
commit d02e5eec4e
1 changed files with 4 additions and 0 deletions

View File

@ -1321,6 +1321,10 @@ class CompendiumBrowser extends Application {
const sortable = Object.entries(packValue) const sortable = Object.entries(packValue)
.map(([key, data]) => { .map(([key, data]) => {
if (typeof data === "string") return [key, game.i18n.localize(data)]; if (typeof data === "string") return [key, game.i18n.localize(data)];
if (!data) {
console.error(`Compendium Browser | Pack Value "${key}" has no data.`);
return [key, ""];
}
return [key, data.label]; return [key, data.label];
}) })
.sort((a, b) => a[1].localeCompare(b[1])); .sort((a, b) => a[1].localeCompare(b[1]));