diff options
author | QbieShay <cislaghi.ilaria@gmail.com> | 2019-02-18 23:25:57 +0100 |
---|---|---|
committer | QbieShay <cislaghi.ilaria@gmail.com> | 2019-02-27 20:42:20 +0100 |
commit | 8f22c2684f3f5982d8ca8871df0b6a73d41ed196 (patch) | |
tree | 57c99f6b1a35b1e6ef0313efc9a17f2a2cc23073 | |
parent | 07498d313c45f54b0a7c6c0b23e635bddf6f0523 (diff) |
Inheriting from virtual class no longer causes the engine to crash, it prints an error instead.
Co-authored-by: Hein-Pieter van Braam <hp@tmm.cx>
-rw-r--r-- | modules/gdscript/gdscript.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index f29432666e..2552dff50a 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<Reference>(owner); if (r) { |