From a75d756a6fc3a9d66d3c1601d5b8aafcbcd57bde Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Thu, 10 Aug 2023 23:43:55 +0900 Subject: [PATCH] use default value if value error --- modules/ui_loadsave.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ui_loadsave.py b/modules/ui_loadsave.py index a96c71b29..9a40cf4fc 100644 --- a/modules/ui_loadsave.py +++ b/modules/ui_loadsave.py @@ -48,13 +48,13 @@ class UiLoadsave: elif condition and not condition(saved_value): pass else: - if isinstance(x, gr.Textbox) and field == 'value': # due to an undersirable behavior of gr.Textbox, if you give it an int value instead of str, everything dies + if isinstance(x, gr.Textbox) and field == 'value': # due to an undesirable behavior of gr.Textbox, if you give it an int value instead of str, everything dies saved_value = str(saved_value) elif isinstance(x, gr.Number) and field == 'value': try: saved_value = float(saved_value) except ValueError: - saved_value = -1 + return setattr(obj, field, saved_value) if init_field is not None: