1
0
Fork 0

Fixed a crash if an app has no tags (app.tags is undefined)

master
BlueFox 2025-01-03 21:39:28 +01:00
parent 036afc5708
commit 824b3447d8
1 changed files with 13 additions and 8 deletions

View File

@ -48,15 +48,20 @@ if (launchCache.hash!=launchHash) {
.filter(app=>app && app.type=="app" || app.type=="clock" || !app.type)
.sort((a,b)=>sort(a,b))
.forEach(app => {
let appTags = app.tags.split(",")
.map(tag => tag.trim())
.map(tag => tag === "tools" ? "tool" : tag) // tool = tools
.filter(tag => Object.keys(tags).includes(tag));
if (appTags.length === 0) {
let appTags = [];
if (!app.tags) {
appTags.push("misc");
} else if (appTags.length > 1 && appTags.indexOf("tool") >= 0) {
// everything has tag 'tool', unregister when at least one other known tag
appTags.splice(appTags.indexOf("tool"), 1);
} else {
appTags = app.tags.split(",")
.map(tag => tag.trim())
.map(tag => tag === "tools" ? "tool" : tag) // tool = tools
.filter(tag => Object.keys(tags).includes(tag));
if (appTags.length === 0) {
appTags.push("misc");
} else if (appTags.length > 1 && appTags.indexOf("tool") >= 0) {
// everything has tag 'tool', unregister when at least one other known tag
appTags.splice(appTags.indexOf("tool"), 1);
}
}
appTags.forEach(tag => appsByTag[tag].push(app));
});