Added checks for None control_net to produce more helpful error messages for users

This commit is contained in:
Jedrzej Kosinski
2024-11-14 03:48:42 -06:00
parent f42c902fd4
commit 3120c14e0a
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -504,6 +504,8 @@ def load_controlnet(ckpt_path, timestep_keyframe: TimestepKeyframeGroup=None, mo
control = comfy_cn.load_controlnet(ckpt_path, model=model)
finally:
comfy.utils.load_torch_file = orig_load_torch_file
if control is None:
raise Exception(f"Something went wrong when loading '{ckpt_path}'; ControlNet is None.")
return convert_to_advanced(control, timestep_keyframe=timestep_keyframe)
+3
View File
@@ -140,6 +140,9 @@ class AdvancedControlNetApply:
if prev_cnet in cnets:
c_net = cnets[prev_cnet]
else:
# make sure control_net is not None to avoid confusing error messages
if control_net is None:
raise Exception("Passed in control_net is None; something must have went wrong when loading it from a Load ControlNet node.")
# copy, convert to advanced if needed, and set cond
c_net = convert_to_advanced(control_net.copy()).set_cond_hint(control_hint, strength, (start_percent, end_percent), vae_optional)
if is_advanced_controlnet(c_net):