Skip to content

Commit 6b8458e

Browse files
w-e-wlight-and-ray
andcommitted
if extensions page not loaded, prevent apply
since they are built-in extensions we can make the assumption that they will be at least one or more extensions Co-Authored-By: Andray <[email protected]>
1 parent d69a794 commit 6b8458e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

javascript/extensions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
function extensions_apply(_disabled_list, _update_list, disable_all) {
33
var disable = [];
44
var update = [];
5-
6-
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x) {
5+
const extensions_input = gradioApp().querySelectorAll('#extensions input[type="checkbox"]');
6+
if (extensions_input.length == 0) {
7+
throw Error("Extensions page not yet loaded.");
8+
}
9+
extensions_input.forEach(function(x) {
710
if (x.name.startsWith("enable_") && !x.checked) {
811
disable.push(x.name.substring(7));
912
}

0 commit comments

Comments
 (0)