From 6c5dfe00696dff7041f2f1ce8610ceb4af3aea5c Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:24:10 +0100 Subject: [PATCH] Fix invalid return value when closing an iterator (#3567) --- core/engine/src/vm/opcode/iteration/iterator.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/engine/src/vm/opcode/iteration/iterator.rs b/core/engine/src/vm/opcode/iteration/iterator.rs index c4dddb79d02..26f11de9378 100644 --- a/core/engine/src/vm/opcode/iteration/iterator.rs +++ b/core/engine/src/vm/opcode/iteration/iterator.rs @@ -250,8 +250,12 @@ impl Operation for IteratorReturn { return Ok(CompletionType::Normal); }; + let return_value = context.vm.get_return_value(); + let value = ret.call(&record.iterator().clone().into(), &[], context)?; + context.vm.set_return_value(return_value); + context.vm.push(value); context.vm.push(true);