Skip to content

Commit

Permalink
🐛 Check items exist before itterating gchq#415
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jan 17, 2022
1 parent b76b8eb commit f25aa07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down

0 comments on commit f25aa07

Please sign in to comment.