Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle selectable script_index is None #14487

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ def setup_ui(self):
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]
Expand Down Expand Up @@ -739,7 +741,7 @@ def onload_script_visibility(params):
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]
Expand Down