From 8f22c2684f3f5982d8ca8871df0b6a73d41ed196 Mon Sep 17 00:00:00 2001 From: QbieShay Date: Mon, 18 Feb 2019 23:25:57 +0100 Subject: [PATCH] Inheriting from virtual class no longer causes the engine to crash, it prints an error instead. Co-authored-by: Hein-Pieter van Braam --- modules/gdscript/gdscript.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index f29432666e56..2552dff50a0e 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -152,12 +152,13 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Variant::CallErro } ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant()); - if (_baseptr->native.ptr()) { owner = _baseptr->native->instance(); } else { owner = memnew(Reference); //by default, no base means use reference } + ERR_EXPLAIN("Can't inherit from a virtual class"); + ERR_FAIL_COND_V(!owner, Variant()); Reference *r = Object::cast_to(owner); if (r) {