From ab9cc075775e9451611395ad27dc20ca58dda9ff Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Tue, 8 Aug 2023 16:25:10 -0400
Subject: fixed searching web pages that are not cors readable to not generate
 an error

---
 src/client/views/nodes/WebBox.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/WebBox.tsx')

diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 34a1229ba..f5df42161 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -125,11 +125,15 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
                 this._searchRef.current?.setRangeText(searchString);
             });
         }
-        if (clear) {
-            this._iframe?.contentWindow?.getSelection()?.empty();
-        }
-        if (searchString) {
-            (this._iframe?.contentWindow as any)?.find(searchString, false, bwd, true);
+        try {
+            if (clear) {
+                this._iframe?.contentWindow?.getSelection()?.empty();
+            }
+            if (searchString) {
+                (this._iframe?.contentWindow as any)?.find(searchString, false, bwd, true);
+            }
+        } catch (e) {
+            console.log("WebBox search error", e)
         }
         return true;
     };
-- 
cgit v1.2.3-70-g09d2

