From 0b0eead4ae9735a9255d5f0fc14cbecfd87b27a2 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 5 May 2025 02:18:24 -0700 Subject: [PATCH] Fix: `image.shape` accessed before `image` is null-checked (#134) --- comfy_api_nodes/nodes_openai.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_api_nodes/nodes_openai.py b/comfy_api_nodes/nodes_openai.py index e3fbbb868..de912af11 100644 --- a/comfy_api_nodes/nodes_openai.py +++ b/comfy_api_nodes/nodes_openai.py @@ -427,10 +427,10 @@ class OpenAIGPTImage1(ComfyNodeABC): files.append(("image[]", img_binary)) if mask is not None: - if image.shape[0] != 1: - raise Exception("Cannot use a mask with multiple image") if image is None: raise Exception("Cannot use a mask without an input image") + if image.shape[0] != 1: + raise Exception("Cannot use a mask with multiple image") if mask.shape[1:] != image.shape[1:-1]: raise Exception("Mask and Image must be the same size") batch, height, width = mask.shape