Skip to content

Commit

Permalink
Add more checks against unexpected conditions re. assets.json
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Apr 22, 2023
1 parent 8616b39 commit 6294829
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1623,13 +1623,17 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

if ( topic === 'assets.json-updated' ) {
const { newDict, oldDict } = details;
if ( newDict['assets.json'] === undefined ) { return; }
if ( oldDict['assets.json'] === undefined ) { return; }
const newDefaultListset = new Set(newDict['assets.json'].defaultListset || []);
const oldDefaultListset = new Set(oldDict['assets.json'].defaultListset || []);
if ( newDefaultListset.size === 0 ) { return; }
if ( oldDefaultListset.size === 0 ) {
Array.from(Object.entries(newDict))
Array.from(Object.entries(oldDict))
.filter(a => a[1].content === 'filters' && a[1].off === undefined)
.map(a => a[0])
.forEach(a => oldDefaultListset.add(a));
if ( oldDefaultListset.size === 0 ) { return; }
}
const selectedListset = new Set(this.selectedFilterLists);
let selectedListModified = false;
Expand Down

0 comments on commit 6294829

Please sign in to comment.