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);
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.intro !== undefined) this.skipIntro = skipOptions.intro;
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.poi_highlight !== undefined) this.skipHighlight = skipOptions.poi_highlight;
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(",");
this.skipSponsor =
this.skipIntro =

View file

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