Merge pull request #14487 from AUTOMATIC1111/handle-selectable-script_index-is-None

handle selectable script_index is None
This commit is contained in:
AUTOMATIC1111 2024-01-01 10:19:58 +03:00 committed by GitHub
commit e55fec9d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -696,6 +696,8 @@ class ScriptRunner:
self.setup_ui_for_section(None, self.selectable_scripts)
def select_script(script_index):
if script_index is None:
script_index = 0
selected_script = self.selectable_scripts[script_index - 1] if script_index>0 else None
return [gr.update(visible=selected_script == s) for s in self.selectable_scripts]
@ -739,7 +741,7 @@ class ScriptRunner:
def run(self, p, *args):
script_index = args[0]
if script_index == 0:
if script_index == 0 or script_index is None:
return None
script = self.selectable_scripts[script_index-1]