chore(highlights): prevent crash if unable to find target element

This commit is contained in:
Elian Doran 2025-03-29 14:10:12 +02:00
parent 04a7ad8d4e
commit a44bf7fb49
No known key found for this signature in database

View File

@ -350,11 +350,13 @@ export default class HighlightsListWidget extends RightPanelWidget {
} }
} }
if (targetElement) { if (targetElement && targetElement[itemIndex]) {
targetElement[itemIndex].scrollIntoView({ targetElement[itemIndex].scrollIntoView({
behavior: "smooth", behavior: "smooth",
block: "center" block: "center"
}); });
} else {
console.warn("Unable to find the target element in the highlights list.");
} }
} }