Fix exception thrown when a stock asset is removed

Related feedback:
- https://www.reddit.com/r/uMatrix/comments/ftebgz/
pull/2/head
Raymond Hill 5 years ago
parent 89b7e026c3
commit 0bcb7669e7
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -496,9 +496,19 @@ self.addEventListener('rawSettingsChanged', ( ) => {
const addedCount = this.ubiquitousBlacklistRef.addedCount; const addedCount = this.ubiquitousBlacklistRef.addedCount;
const addCount = this.ubiquitousBlacklistRef.addCount; const addCount = this.ubiquitousBlacklistRef.addCount;
this.mergeHostsFileContent(details.content); // https://www.reddit.com/r/uMatrix/comments/ftebgz/
// Be ready to deal with a removed asset.
if ( typeof details.content === 'string' && details.content !== '' ) {
this.mergeHostsFileContent(details.content);
}
const hostsFileMeta = this.liveHostsFiles.get(details.assetKey); const hostsFileMeta = this.liveHostsFiles.get(details.assetKey);
if ( hostsFileMeta === undefined ) {
this.liveHostsFiles.delete(details.assetKey);
return;
}
hostsFileMeta.entryCount = hostsFileMeta.entryCount =
this.ubiquitousBlacklistRef.addCount - addCount; this.ubiquitousBlacklistRef.addCount - addCount;
hostsFileMeta.entryUsedCount = hostsFileMeta.entryUsedCount =

Loading…
Cancel
Save