Fix a crash in gdscript callbacks

This fixes a crash running the 'goltorus' project.
This commit is contained in:
Hein-Pieter van Braam 2017-08-27 23:49:13 +02:00
parent 9e0fbb49c1
commit 8064fbb174
1 changed files with 2 additions and 2 deletions

View File

@ -1418,7 +1418,7 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount
// If the return value is a GDFunctionState reference, // If the return value is a GDFunctionState reference,
// then the function did yield again after resuming. // then the function did yield again after resuming.
if (ret.is_ref()) { if (ret.is_ref()) {
GDFunctionState *gdfs = Object::cast_to<GDFunctionState>((Object *)&ret); GDFunctionState *gdfs = Object::cast_to<GDFunctionState>(ret);
if (gdfs && gdfs->function == function) if (gdfs && gdfs->function == function)
completed = false; completed = false;
} }
@ -1474,7 +1474,7 @@ Variant GDFunctionState::resume(const Variant &p_arg) {
// If the return value is a GDFunctionState reference, // If the return value is a GDFunctionState reference,
// then the function did yield again after resuming. // then the function did yield again after resuming.
if (ret.is_ref()) { if (ret.is_ref()) {
GDFunctionState *gdfs = Object::cast_to<GDFunctionState>((Object *)&ret); GDFunctionState *gdfs = Object::cast_to<GDFunctionState>(ret);
if (gdfs && gdfs->function == function) if (gdfs && gdfs->function == function)
completed = false; completed = false;
} }