From d040ecf184d3fe2252fc820e9f6c8af3ba886d05 Mon Sep 17 00:00:00 2001 From: Bingsu Date: Sat, 6 May 2023 10:44:34 +0900 Subject: [PATCH] fix: error when args length < 2 --- scripts/!adetailer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 0498201..7f29702 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -6,6 +6,7 @@ import traceback from copy import copy, deepcopy from itertools import zip_longest from pathlib import Path +from textwrap import dedent import gradio as gr import torch @@ -272,7 +273,10 @@ class AfterDetailerScript(scripts.Script): def is_ad_enabled(self, *args_) -> bool: if len(args_) < 2: - return False + message = f"""[-] ADetailer: Not enough arguments passed to adetailer. + input: {args_!r} + """ + raise ValueError(dedent(message)) checker = EnableChecker(ad_enable=args_[0], ad_model=args_[1]) return checker.is_enabled()