From 8607b1994ccbf34dcbc8a55334cc814e5e66e857 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:09:41 +1000 Subject: [PATCH] fix(ui): fix crash when controlnet enabled but no controlnets added --- .../web/src/features/nodes/util/addControlNetToLinearGraph.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts index 6ae3f21bdf..8baf7cdabe 100644 --- a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts @@ -12,8 +12,10 @@ export const addControlNetToLinearGraph = ( ): void => { const { isEnabled: isControlNetEnabled, controlNets } = state.controlNet; + const controlNetCount = size(controlNets); + // Add ControlNet - if (isControlNetEnabled) { + if (isControlNetEnabled && controlNetCount > 0) { if (size(controlNets) > 1) { const controlNetIterateNode: CollectInvocation = { id: CONTROL_NET_COLLECT,