diff --git a/src/popup-dropdown-view-model.ts b/src/popup-dropdown-view-model.ts index 9882e89322..5e2409b963 100644 --- a/src/popup-dropdown-view-model.ts +++ b/src/popup-dropdown-view-model.ts @@ -25,8 +25,10 @@ export class PopupDropdownViewModel extends PopupBaseViewModel { if(!this.targetElement) return; const targetElementRect = this.targetElement.getBoundingClientRect(); const background = this.container.children[0]; + if(!background) return; const popupContainer = background.children[0]; - const scrollContent = background.children[0].querySelector(".sv-popup__scrolling-content"); + if(!popupContainer) return; + const scrollContent = popupContainer.querySelector(".sv-popup__scrolling-content"); const popupComputedStyle = window.getComputedStyle(popupContainer); const marginLeft = (parseFloat(popupComputedStyle.marginLeft) || 0); const marginRight = (parseFloat(popupComputedStyle.marginRight) || 0);