Improved stability of clockinfo in case a clock info app raises an exception

master
David Peer 2022-10-02 15:51:58 +02:00
parent ae84bc9a18
commit faabba9919
1 changed files with 8 additions and 4 deletions

View File

@ -97,10 +97,14 @@ exports.load = function() {
// In case there exists already a menu object b with the same name as the next // In case there exists already a menu object b with the same name as the next
// object a, we append the items. Otherwise we add the new object a to the list. // object a, we append the items. Otherwise we add the new object a to the list.
require("Storage").list(/clkinfo.js$/).forEach(fn => { require("Storage").list(/clkinfo.js$/).forEach(fn => {
try{
var a = eval(require("Storage").read(fn))(); var a = eval(require("Storage").read(fn))();
var b = menu.find(x => x.name === a.name) var b = menu.find(x => x.name === a.name)
if(b) b.items = b.items.concat(a.items); if(b) b.items = b.items.concat(a.items);
else menu = menu.concat(a); else menu = menu.concat(a);
} catch(e){
console.log("Could not load clock info.")
}
}); });
// return it all! // return it all!