From d21dad389019610bb834a07fe7c271cec88d016a Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Thu, 22 Aug 2024 13:45:00 +0200 Subject: [PATCH] merian-nodes: NodeIO: More assertions --- include/merian-nodes/graph/node_io.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/merian-nodes/graph/node_io.hpp b/include/merian-nodes/graph/node_io.hpp index 43512a7..7caec48 100644 --- a/include/merian-nodes/graph/node_io.hpp +++ b/include/merian-nodes/graph/node_io.hpp @@ -57,7 +57,11 @@ class NodeIO { std::is_base_of_v, T>, bool> = true> ResourceAccessType operator[](const std::shared_ptr& input_connector) const { - assert(resource_for_input_connector(input_connector) && + assert(input_connector && "input connector cannot be null"); + assert((input_connector->optional || resource_for_input_connector(input_connector)) && + "non-optional input connector is not connected. This should be prevented by the " + "Graph."); + assert((!input_connector->optional || resource_for_input_connector(input_connector)) && "optional input connector is not connected"); return input_connector->resource(resource_for_input_connector(input_connector)); }