From c8b52c79755618736aec40a80d72043967274a59 Mon Sep 17 00:00:00 2001 From: DejitaruJin Date: Sat, 4 Mar 2023 19:32:09 -0500 Subject: [PATCH] Short-circuit error handling --- scripts/xyz_grid.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 7ed8a9da..f79c46f6 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -618,13 +618,17 @@ class Script(scripts.Script): margin_size=margin_size ) + if not processed.images: + # It broke, no further handling needed. + return processed + z_count = len(zs) if not include_lone_images: # Don't need sub-images anymore, drop from list: processed.images = processed.images[:z_count+1] - if opts.grid_save and processed.images: + if opts.grid_save: # Auto-save main and sub-grids: grid_count = z_count + 1 if z_count > 1 else 1 for g in range(grid_count):