summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gd_script.cpp')
-rw-r--r--modules/gdscript/gd_script.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 12fc36d8c1..dcd0641f76 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -145,8 +145,11 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
_baseptr=_baseptr->_base;
}
- ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant());
- owner=_baseptr->native->instance();
+ if (_baseptr->native.ptr()) {
+ owner=_baseptr->native->instance();
+ } else {
+ owner=memnew( Reference ); //by default, no base means use reference
+ }
Reference *r=owner->cast_to<Reference>();
if (r) {