Fix handling of unset preferences

This commit is contained in:
novenary 2023-02-06 19:18:04 +02:00
parent 45a1e4981e
commit f03e323f90
2 changed files with 3 additions and 3 deletions

View File

@ -503,7 +503,7 @@ export default {
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true); this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
var skipOptions, skipList; var skipOptions, skipList;
if ((skipOptions = this.getPreferenceJSON("skipOptions")) !== null) { if ((skipOptions = this.getPreferenceJSON("skipOptions")) !== undefined) {
if (skipOptions.sponsor !== undefined) this.skipSponsor = skipOptions.sponsor; if (skipOptions.sponsor !== undefined) this.skipSponsor = skipOptions.sponsor;
if (skipOptions.intro !== undefined) this.skipIntro = skipOptions.intro; if (skipOptions.intro !== undefined) this.skipIntro = skipOptions.intro;
if (skipOptions.outro !== undefined) this.skipOutro = skipOptions.outro; if (skipOptions.outro !== undefined) this.skipOutro = skipOptions.outro;
@ -513,7 +513,7 @@ export default {
if (skipOptions.music_offtopic !== undefined) this.skipMusicOffTopic = skipOptions.music_offtopic; if (skipOptions.music_offtopic !== undefined) this.skipMusicOffTopic = skipOptions.music_offtopic;
if (skipOptions.poi_highlight !== undefined) this.skipHighlight = skipOptions.poi_highlight; if (skipOptions.poi_highlight !== undefined) this.skipHighlight = skipOptions.poi_highlight;
if (skipOptions.filler !== undefined) this.skipFiller = skipOptions.filler; if (skipOptions.filler !== undefined) this.skipFiller = skipOptions.filler;
} else if ((skipList = this.getPreferenceString("selectedSkip")) !== null) { } else if ((skipList = this.getPreferenceString("selectedSkip")) !== undefined) {
skipList = skipList.split(","); skipList = skipList.split(",");
this.skipSponsor = this.skipSponsor =
this.skipIntro = this.skipIntro =

View File

@ -372,7 +372,7 @@ export default {
"sponsor,interaction,selfpromo,music_offtopic", "sponsor,interaction,selfpromo,music_offtopic",
).split(","); ).split(",");
const skipOptions = this.getPreferenceJSON("skipOptions"); const skipOptions = this.getPreferenceJSON("skipOptions");
if (skipOptions !== null) { if (skipOptions !== undefined) {
selectedSkip = Object.keys(skipOptions).filter( selectedSkip = Object.keys(skipOptions).filter(
k => skipOptions[k] !== undefined && skipOptions[k] !== "no", k => skipOptions[k] !== undefined && skipOptions[k] !== "no",
); );