From 48da11372edd481d04b7009785c0609139179c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 21 Mar 2017 02:13:55 +0100 Subject: [PATCH] Fix random crashes when using yield() --- modules/gdscript/gd_function.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 638c28c4e45..91c5478068d 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -160,7 +160,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (p_state) { //use existing (supplied) state (yielded) stack = (Variant *)p_state->stack.ptr(); - call_args = (Variant **)stack + sizeof(Variant) * p_state->stack_size; + call_args = (Variant **)&p_state->stack.ptr()[sizeof(Variant) * p_state->stack_size]; //ptr() to avoid bounds check line = p_state->line; ip = p_state->ip; alloca_size = p_state->stack.size();