From 8064fbb1747568729236e7d2eb21cdc3e3e555fd Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Sun, 27 Aug 2017 23:49:13 +0200 Subject: [PATCH] Fix a crash in gdscript callbacks This fixes a crash running the 'goltorus' project. --- modules/gdscript/gd_function.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 81bf4664d8f..e6f65fe0c2e 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -1418,7 +1418,7 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount // If the return value is a GDFunctionState reference, // then the function did yield again after resuming. if (ret.is_ref()) { - GDFunctionState *gdfs = Object::cast_to((Object *)&ret); + GDFunctionState *gdfs = Object::cast_to(ret); if (gdfs && gdfs->function == function) completed = false; } @@ -1474,7 +1474,7 @@ Variant GDFunctionState::resume(const Variant &p_arg) { // If the return value is a GDFunctionState reference, // then the function did yield again after resuming. if (ret.is_ref()) { - GDFunctionState *gdfs = Object::cast_to((Object *)&ret); + GDFunctionState *gdfs = Object::cast_to(ret); if (gdfs && gdfs->function == function) completed = false; }