Patch #12453
This commit is contained in:
AUTOMATIC1111 2023-08-10 17:55:31 +03:00 committed by GitHub
commit 458eda1321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,13 +48,13 @@ class UiLoadsave:
elif condition and not condition(saved_value): elif condition and not condition(saved_value):
pass pass
else: 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) saved_value = str(saved_value)
elif isinstance(x, gr.Number) and field == 'value': elif isinstance(x, gr.Number) and field == 'value':
try: try:
saved_value = float(saved_value) saved_value = float(saved_value)
except ValueError: except ValueError:
saved_value = -1 return
setattr(obj, field, saved_value) setattr(obj, field, saved_value)
if init_field is not None: if init_field is not None: