Merge pull request #34958 from vnen/gdscript-is-check-valid-instance

GDScript: Validate object instance on `is` operation
This commit is contained in:
Rémi Verschelde
2020-01-10 07:40:56 +01:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -500,6 +500,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
Object *obj_A = *a;
Object *obj_B = *b;
#ifdef DEBUG_ENABLED
if (!ObjectDB::instance_validate(obj_A)) {
err_text = "Left operand of 'is' was already freed.";
OPCODE_BREAK;
}
#endif // DEBUG_ENABLED
GDScript *scr_B = Object::cast_to<GDScript>(obj_B);
if (scr_B) {