aboutsummaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_function.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez2017-03-21 02:13:55 +0100
committerPedro J. Estébanez2017-03-21 02:54:46 +0100
commit48da11372edd481d04b7009785c0609139179c49 (patch)
treefe5c9c788c4c41a6ea2d93a2a403f715fbd28a83 /modules/gdscript/gd_function.cpp
parent9c75b9dddf18abf315f62caa6745daa05d4adbaf (diff)
downloadgodot-48da11372edd481d04b7009785c0609139179c49.tar.gz
godot-48da11372edd481d04b7009785c0609139179c49.tar.zst
godot-48da11372edd481d04b7009785c0609139179c49.zip
Fix random crashes when using yield()
Diffstat (limited to 'modules/gdscript/gd_function.cpp')
-rw-r--r--modules/gdscript/gd_function.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index 638c28c4e..91c547806 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();