From 8467d28b16de1a1a01efa5157cfc404bf594c0c8 Mon Sep 17 00:00:00 2001 From: Jacob Edie Date: Tue, 6 Oct 2020 22:12:47 -0400 Subject: [PATCH] added temp variable because *p_inputs[2] is the same as *p_outputs[0] (cherry picked from commit d76457a7f39cade4f0bccfc8c68eb1b1c5a59c44) --- modules/visual_script/visual_script_nodes.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index dc49ed72d0e..f1165586687 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1788,8 +1788,10 @@ public: virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) { bool valid; + // *p_output[0] points to the same place as *p_inputs[2] so we need a temp to store the value before the change in the next line + Variant temp = *p_inputs[2]; *p_outputs[0] = *p_inputs[0]; - p_outputs[0]->set(*p_inputs[1], *p_inputs[2], &valid); + p_outputs[0]->set(*p_inputs[1], temp, &valid); if (!valid) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;