فهرست منبع

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

Jacob Edie 4 سال پیش
والد
کامیت
d76457a7f3
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      modules/visual_script/visual_script_nodes.cpp

+ 3 - 1
modules/visual_script/visual_script_nodes.cpp

@@ -1706,8 +1706,10 @@ public:
 
 	virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::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 = Callable::CallError::CALL_ERROR_INVALID_METHOD;