summaryrefslogtreecommitdiff
path: root/scene/3d/shape_cast_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/shape_cast_3d.cpp')
-rw-r--r--scene/3d/shape_cast_3d.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp
index d880e422f0..602eb664dd 100644
--- a/scene/3d/shape_cast_3d.cpp
+++ b/scene/3d/shape_cast_3d.cpp
@@ -331,16 +331,14 @@ void ShapeCast3D::set_shape(const Ref<Shape3D> &p_shape) {
if (p_shape == shape) {
return;
}
- if (!shape.is_null()) {
+ if (shape.is_valid()) {
shape->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast3D::_shape_changed));
shape->unregister_owner(this);
}
shape = p_shape;
- if (!shape.is_null()) {
+ if (shape.is_valid()) {
shape->register_owner(this);
shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast3D::_shape_changed));
- }
- if (p_shape.is_valid()) {
shape_rid = shape->get_rid();
}