Skip to content

Commit

Permalink
Fix issue #64 dwmartin found with undefined values in metadatagrid. C…
Browse files Browse the repository at this point in the history
…an't repro, but this should prevent it from happening again.
  • Loading branch information
kbuffington committed Jan 15, 2021
1 parent b55fd9b commit 778ac9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ function migrateCheck(version, storedVersion) {
* @param {number} position 0-based index of place to insert new value if existing entry not found
*/
const replaceGridEntry = (grid, label, position) => {
const entryIdx = grid.findIndex(gridEntry => gridEntry.label.toLowerCase() === label.toLowerCase());
const newVal = defaultMetadataGrid[defaultMetadataGrid.findIndex(e => e.label.toLowerCase() === label.toLowerCase())];
const entryIdx = grid.findIndex(gridEntry => gridEntry && gridEntry.label.toLowerCase() === label.toLowerCase());
const newVal = defaultMetadataGrid[defaultMetadataGrid.findIndex(e => e && e.label.toLowerCase() === label.toLowerCase())];
if (entryIdx >= 0) {
grid[entryIdx] = newVal;
} else {
Expand Down

0 comments on commit 778ac9a

Please sign in to comment.