aboutsummaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'script.js')
-rw-r--r--script.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/script.js b/script.js
index 0e117d06..21960d91 100644
--- a/script.js
+++ b/script.js
@@ -1,5 +1,6 @@
function gradioApp() {
- const gradioShadowRoot = document.getElementsByTagName('gradio-app')[0].shadowRoot
+ const elems = document.getElementsByTagName('gradio-app')
+ const gradioShadowRoot = elems.length == 0 ? null : elems[0].shadowRoot
return !!gradioShadowRoot ? gradioShadowRoot : document;
}