Fix UnboundLocalError when resize gets an invalid upscaler name

The invalid-upscaler warning referenced selected_upscaler, which is only
assigned when a matching upscaler was found, so an unknown name (stale
infotext, removed upscaler) crashed the resize instead of falling back
to plain resampling.

https: //claude.ai/code/session_014QWKWgKvMevcuvfCnsYoT2
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-06-11 08:15:35 +00:00
committed by QualiaRain
parent 1225abc265
commit 77f7fc61bd
+1 -1
View File
@@ -51,7 +51,7 @@ def resize_image(resize_mode: int, im: Image.Image | torch.Tensor, width: int, h
else:
im = selected_upscaler.scaler.upscale(im, scale, selected_upscaler.name)
else:
log.warning(f"Resize upscaler: invalid={upscaler_name} fallback={selected_upscaler.name}")
log.warning(f"Resize upscaler: invalid={upscaler_name} fallback=resample")
log.debug(f"Resize upscaler: available={[u.name for u in shared.sd_upscalers]}")
if isinstance(im, Image.Image) and (im.width != w or im.height != h): # probably downsample after upscaler created larger image
im = sharpfin.resize(im, (w, h))