From 75eb5bd309bcb0f36cecda7f759a7c41bbc2d4b6 Mon Sep 17 00:00:00 2001 From: SrGesus <108523575+SrGesus@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:09:26 +0100 Subject: [PATCH] fix(ecs): add assert for QueryFilter::update to avoid compiler error --- core/src/ecs/query/filter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/ecs/query/filter.cpp b/core/src/ecs/query/filter.cpp index f02db4091..277250064 100644 --- a/core/src/ecs/query/filter.cpp +++ b/core/src/ecs/query/filter.cpp @@ -134,7 +134,10 @@ void QueryFilter::update() // Update the pin masks with which each node will run. mNodePins[0] = 0; - for (int i = 1; i < mNodeCount; ++i) + // Copy mNodeCount since the compiler thinks it will change. See issue #1351 + int nodeCount = this->mNodeCount; + CUBOS_ASSERT(nodeCount <= QueryNode::MaxCursorCount); + for (int i = 1; i < nodeCount; ++i) { mNodePins[i] = mNodePins[i - 1] | mNodes[i - 1]->pins(); }