mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-04-27 09:02:08 +12:00
Fix exception thrown when a stock asset is removed
Related feedback: - https://www.reddit.com/r/uMatrix/comments/ftebgz/
This commit is contained in:
parent
89b7e026c3
commit
0bcb7669e7
|
@ -496,9 +496,19 @@ self.addEventListener('rawSettingsChanged', ( ) => {
|
|||
const addedCount = this.ubiquitousBlacklistRef.addedCount;
|
||||
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);
|
||||
if ( hostsFileMeta === undefined ) {
|
||||
this.liveHostsFiles.delete(details.assetKey);
|
||||
return;
|
||||
}
|
||||
|
||||
hostsFileMeta.entryCount =
|
||||
this.ubiquitousBlacklistRef.addCount - addCount;
|
||||
hostsFileMeta.entryUsedCount =
|
||||
|
|
Loading…
Reference in a new issue