Short-circuit error handling

This commit is contained in:
DejitaruJin 2023-03-04 19:32:09 -05:00 committed by GitHub
parent eb29ff211a
commit c8b52c7975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -618,13 +618,17 @@ class Script(scripts.Script):
margin_size=margin_size margin_size=margin_size
) )
if not processed.images:
# It broke, no further handling needed.
return processed
z_count = len(zs) z_count = len(zs)
if not include_lone_images: if not include_lone_images:
# Don't need sub-images anymore, drop from list: # Don't need sub-images anymore, drop from list:
processed.images = processed.images[:z_count+1] processed.images = processed.images[:z_count+1]
if opts.grid_save and processed.images: if opts.grid_save:
# Auto-save main and sub-grids: # Auto-save main and sub-grids:
grid_count = z_count + 1 if z_count > 1 else 1 grid_count = z_count + 1 if z_count > 1 else 1
for g in range(grid_count): for g in range(grid_count):