Avoid crash in Variant constructor from nullptr Object*

pull/659/head
Gilles Roudière 2021-11-22 16:57:51 +01:00
parent 271e33658d
commit 55ba2602db
1 changed files with 6 additions and 1 deletions

View File

@ -171,7 +171,12 @@ Variant::Variant(const godot::RID &v) {
}
Variant::Variant(const Object *v) {
from_type_constructor[OBJECT](ptr(), const_cast<GodotObject **>(&v->_owner));
if (v) {
from_type_constructor[OBJECT](ptr(), const_cast<GodotObject **>(&v->_owner));
} else {
GodotObject *nullobject = nullptr;
from_type_constructor[OBJECT](ptr(), &nullobject);
}
}
Variant::Variant(const Callable &v) {