From 4412398c4b40f0dd3a1692f65141374770fbc3da Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Thu, 10 Aug 2023 22:44:33 +0900 Subject: [PATCH] catch float ValueError default -1 --- modules/ui_loadsave.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ui_loadsave.py b/modules/ui_loadsave.py index ef6b0154e..a96c71b29 100644 --- a/modules/ui_loadsave.py +++ b/modules/ui_loadsave.py @@ -51,7 +51,10 @@ class UiLoadsave: 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 saved_value = str(saved_value) elif isinstance(x, gr.Number) and field == 'value': - saved_value = float(saved_value) + try: + saved_value = float(saved_value) + except ValueError: + saved_value = -1 setattr(obj, field, saved_value) if init_field is not None: