Nodes/ComfyUI-KYNode/Block if None or empty
ComfyUI Node

Block if None or empty

A gate, not just a check

By yorkane·Created 2 years ago·Updated 6 months ago· 10
Block if None or empty
  • any
  • out
  • is_empty
reversefalse
block_executionfalse

This is a single-value version of the emptiness check this pack's KY_First_NOT_EMPTY runs across several candidates - except this one can actually stop your graph from continuing, not just report a boolean and let you decide what to do with it. Wire a value in, and depending on how you configure it, either just tell you whether it's empty, or halt everything downstream of this node if it is.

What "empty" means here

The display name says "None or empty," and given this node sits in the same KYNode/Utils category as KY_First_NOT_EMPTY - from the same author, using the same vocabulary - it's a fair bet the same broad definition of "empty" applies: not just None, but empty strings, empty collections, empty tensors, and (worth remembering from that sibling node) the number 0 too. If you're gating on a genuine numeric value where zero is meaningful, don't assume this node treats it as "present" without testing it directly.

Inputs and outputs

One required input: any, wildcard-typed - the value being checked. Two optional booleans: reverse (default false) flips the check, so instead of testing "is this empty," it tests "is this not empty" - useful for building a "only continue if this already has a value" gate rather than the reverse. block_execution (default false) is the one that actually matters for control flow: leave it off and this node just reports the result; flip it on and an empty value (or a non-empty one, if reverse is also on) stops the graph from executing anything wired downstream of this node.

Two outputs: out (the input value, passed straight through unchanged) and is_empty (BOOLEAN, the result of the check).

Where you'd use it

A defensive gate before something expensive or something that'll error on a blank input - skip a captioning call if the image slot is empty, skip a save if the filename string never got set, skip an LLM request if the prompt field is blank. Combined with reverse, it also works as the opposite: only proceed once a value that starts empty (say, populated by an earlier conditional branch) has actually been filled in.

Installing it

ComfyUI Manager: search ComfyUI-KYNode, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yorkane/ComfyUI-KYNode

Restart ComfyUI. No external dependencies - pure logic.

Common issues

block_execution defaults to false, which catches people off guard: simply wiring this node in and expecting it to gate your graph does nothing until you deliberately flip that boolean on. If you added this node specifically to stop a bad run and nothing changed, check that setting first.

reverse and block_execution combined is a legitimate and slightly non-obvious pattern - "block if this is not empty" - worth remembering as a way to build a "skip if already done" style gate, not just the more intuitive "block if empty" direction.

And as above: if a value you expect to read as "empty" (particularly a numeric 0) doesn't behave the way you expect, that's the same broad emptiness definition this pack's KY_First_NOT_EMPTY documents explicitly - test the exact value you care about rather than assuming only None triggers it.

CategoryKYNode/Utils

Inputs (3)

NameTypeDefaultDescription
any*
reverseoptBOOLEANfalse
block_executionoptBOOLEANfalse

Outputs (2)

NameTypeDescription
out*
is_emptyBOOLEAN