added temp variable because *p_inputs[2] is the same as *p_outputs[0]

(cherry picked from commit d76457a7f3)
This commit is contained in:
Jacob Edie 2020-10-06 22:12:47 -04:00 committed by Rémi Verschelde
parent f7ea1e6b38
commit 8467d28b16
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 1 deletions

View File

@ -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;