Fix crash when using Camera2D::set_custom_viewport()

This commit is contained in:
Haoyu Qiu 2022-03-31 16:42:14 +08:00
parent 383f79e4f1
commit b89befe173

View file

@ -583,6 +583,10 @@ void Camera2D::set_custom_viewport(Node *p_viewport) {
remove_from_group(canvas_group_name);
}
if (custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) {
viewport = nullptr;
}
custom_viewport = Object::cast_to<Viewport>(p_viewport);
if (custom_viewport) {