mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Don't crash if bar types are missing
This commit is contained in:
@@ -21,8 +21,8 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
|
|||||||
|
|
||||||
// Setup state
|
// Setup state
|
||||||
this.state = {
|
this.state = {
|
||||||
color: props.defaultColor || Config.config.barTypes[this.props.category].color,
|
color: props.defaultColor || Config.config.barTypes[this.props.category]?.color,
|
||||||
previewColor: props.defaultPreviewColor || Config.config.barTypes["preview-" + this.props.category].color,
|
previewColor: props.defaultPreviewColor || Config.config.barTypes["preview-" + this.props.category]?.color,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class PreviewBar {
|
|||||||
|
|
||||||
bar.setAttribute('data-vs-segment-type', barSegmentType);
|
bar.setAttribute('data-vs-segment-type', barSegmentType);
|
||||||
|
|
||||||
bar.style.backgroundColor = Config.config.barTypes[barSegmentType].color;
|
bar.style.backgroundColor = Config.config.barTypes[barSegmentType]?.color;
|
||||||
if (!this.onMobileYouTube) bar.style.opacity = Config.config.barTypes[barSegmentType].opacity;
|
if (!this.onMobileYouTube) bar.style.opacity = Config.config.barTypes[barSegmentType].opacity;
|
||||||
|
|
||||||
bar.style.position = "absolute";
|
bar.style.position = "absolute";
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
|
|
||||||
const categoryColorCircle = document.createElement("span");
|
const categoryColorCircle = document.createElement("span");
|
||||||
categoryColorCircle.id = "sponsorTimesCategoryColorCircle" + UUID;
|
categoryColorCircle.id = "sponsorTimesCategoryColorCircle" + UUID;
|
||||||
categoryColorCircle.style.backgroundColor = Config.config.barTypes[segmentTimes[i].category].color;
|
categoryColorCircle.style.backgroundColor = Config.config.barTypes[segmentTimes[i].category]?.color;
|
||||||
categoryColorCircle.classList.add("dot");
|
categoryColorCircle.classList.add("dot");
|
||||||
categoryColorCircle.classList.add("sponsorTimesCategoryColorCircle");
|
categoryColorCircle.classList.add("sponsorTimesCategoryColorCircle");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user