mirror of https://github.com/lissy93/dashy
🐛 Check items exist before itterating #415
This commit is contained in:
parent
b76b8eb620
commit
f25aa07d5f
|
@ -70,8 +70,10 @@ const store = new Vuex.Store({
|
|||
getItemById: (state, getters) => (id) => {
|
||||
let item;
|
||||
getters.sections.forEach(sec => {
|
||||
const foundItem = sec.items.find((itm) => itm.id === id);
|
||||
if (foundItem) item = foundItem;
|
||||
if (sec.items) {
|
||||
const foundItem = sec.items.find((itm) => itm.id === id);
|
||||
if (foundItem) item = foundItem;
|
||||
}
|
||||
});
|
||||
return item;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue