Merge pull request #659 from groud/fix_null_init

Avoid crash in Variant constructor from nullptr Object*
pull/664/head
Bastiaan Olij 2021-11-25 11:16:55 +11:00 committed by GitHub
commit 50512f0dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) { Variant::Variant(const Object *v) {
if (v) {
from_type_constructor[OBJECT](ptr(), const_cast<GodotObject **>(&v->_owner)); 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) { Variant::Variant(const Callable &v) {