Sfoglia il codice sorgente

fix: conditions builder throw an error

Ahmad Kholid 3 anni fa
parent
commit
03a0517f2f
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      src/content/handleTestCondition.js

+ 5 - 1
src/content/handleTestCondition.js

@@ -13,7 +13,11 @@ function handleConditionElement({ data, type }) {
     exists: () => Boolean(element),
     notExists: () => !element,
     text: () => element?.innerText ?? null,
-    visibleScreen: () => visibleInViewport(element),
+    visibleScreen: () => {
+      if (!element) return false;
+
+      return visibleInViewport(element);
+    },
     visible: () => {
       if (!element) return false;