Skip to content

Commit

Permalink
Merge pull request godotengine#77945 from AThousandShips/null_check
Browse files Browse the repository at this point in the history
Use NULL instead of COND checks when appropriate
  • Loading branch information
akien-mga committed Jun 10, 2023
2 parents fe0ee24 + dcd2b88 commit 65969dd
Show file tree
Hide file tree
Showing 43 changed files with 123 additions and 126 deletions.
8 changes: 4 additions & 4 deletions scene/2d/area_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int Area2D::get_priority() const {
void Area2D::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);

HashMap<ObjectID, BodyState>::Iterator E = body_map.find(p_id);
ERR_FAIL_COND(!E);
Expand All @@ -151,7 +151,7 @@ void Area2D::_body_enter_tree(ObjectID p_id) {
void Area2D::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
HashMap<ObjectID, BodyState>::Iterator E = body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_tree);
Expand Down Expand Up @@ -231,7 +231,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
void Area2D::_area_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);

HashMap<ObjectID, AreaState>::Iterator E = area_map.find(p_id);
ERR_FAIL_COND(!E);
Expand All @@ -247,7 +247,7 @@ void Area2D::_area_enter_tree(ObjectID p_id) {
void Area2D::_area_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
HashMap<ObjectID, AreaState>::Iterator E = area_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_tree);
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/cpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ void CPUParticles2D::_notification(int p_what) {

void CPUParticles2D::convert_from_particles(Node *p_particles) {
GPUParticles2D *gpu_particles = Object::cast_to<GPUParticles2D>(p_particles);
ERR_FAIL_COND_MSG(!gpu_particles, "Only GPUParticles2D nodes can be converted to CPUParticles2D.");
ERR_FAIL_NULL_MSG(gpu_particles, "Only GPUParticles2D nodes can be converted to CPUParticles2D.");

set_emitting(gpu_particles->is_emitting());
set_amount(gpu_particles->get_amount());
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/node_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const

Node2D *parent_2d = Object::cast_to<Node2D>(get_parent());

ERR_FAIL_COND_V(!parent_2d, Transform2D());
ERR_FAIL_NULL_V(parent_2d, Transform2D());
if (p_parent == parent_2d) {
return get_transform();
} else {
Expand Down
17 changes: 8 additions & 9 deletions scene/2d/physics_body_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ TypedArray<PhysicsBody2D> PhysicsBody2D::get_collision_exceptions() {
void PhysicsBody2D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
ERR_FAIL_NULL_MSG(physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
PhysicsServer2D::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid());
}

void PhysicsBody2D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
ERR_FAIL_NULL_MSG(physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
}

Expand Down Expand Up @@ -323,9 +323,8 @@ AnimatableBody2D::AnimatableBody2D() :
void RigidBody2D::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);

ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(node);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(E->value.in_scene);
Expand All @@ -345,8 +344,8 @@ void RigidBody2D::_body_enter_tree(ObjectID p_id) {
void RigidBody2D::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(node);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_scene);
Expand All @@ -370,7 +369,7 @@ void RigidBody2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan
Object *obj = ObjectDB::get_instance(objid);
Node *node = Object::cast_to<Node>(obj);

ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(objid);

ERR_FAIL_COND(!body_in && !E);
Expand Down Expand Up @@ -849,7 +848,7 @@ RigidBody2D::CCDMode RigidBody2D::get_continuous_collision_detection_mode() cons
}

TypedArray<Node2D> RigidBody2D::get_colliding_bodies() const {
ERR_FAIL_COND_V(!contact_monitor, TypedArray<Node2D>());
ERR_FAIL_NULL_V(contact_monitor, TypedArray<Node2D>());

TypedArray<Node2D> ret;
ret.resize(contact_monitor->body_map.size());
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/ray_cast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void RayCast2D::_update_raycast_state() {
ERR_FAIL_COND(w2d.is_null());

PhysicsDirectSpaceState2D *dss = PhysicsServer2D::get_singleton()->space_get_direct_state(w2d->get_space());
ERR_FAIL_COND(!dss);
ERR_FAIL_NULL(dss);

Transform2D gt = get_global_transform();

Expand Down
2 changes: 1 addition & 1 deletion scene/2d/shape_cast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void ShapeCast2D::_update_shapecast_state() {
ERR_FAIL_COND(w2d.is_null());

PhysicsDirectSpaceState2D *dss = PhysicsServer2D::get_singleton()->space_get_direct_state(w2d->get_space());
ERR_FAIL_COND(!dss);
ERR_FAIL_NULL(dss);

Transform2D gt = get_global_transform();

Expand Down
2 changes: 1 addition & 1 deletion scene/2d/skeleton_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void Bone2D::apply_rest() {
}

int Bone2D::get_index_in_skeleton() const {
ERR_FAIL_COND_V(!skeleton, -1);
ERR_FAIL_NULL_V(skeleton, -1);
skeleton->_update_bone_setup();
return skeleton_index;
}
Expand Down
8 changes: 4 additions & 4 deletions scene/3d/area_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void Area3D::_initialize_wind() {
void Area3D::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);

HashMap<ObjectID, BodyState>::Iterator E = body_map.find(p_id);
ERR_FAIL_COND(!E);
Expand All @@ -206,7 +206,7 @@ void Area3D::_body_enter_tree(ObjectID p_id) {
void Area3D::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
HashMap<ObjectID, BodyState>::Iterator E = body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_tree);
Expand Down Expand Up @@ -379,7 +379,7 @@ void Area3D::set_monitoring(bool p_enable) {
void Area3D::_area_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);

HashMap<ObjectID, AreaState>::Iterator E = area_map.find(p_id);
ERR_FAIL_COND(!E);
Expand All @@ -395,7 +395,7 @@ void Area3D::_area_enter_tree(ObjectID p_id) {
void Area3D::_area_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
HashMap<ObjectID, AreaState>::Iterator E = area_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_tree);
Expand Down
10 changes: 5 additions & 5 deletions scene/3d/bone_attachment_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ void BoneAttachment3D::_update_external_skeleton_cache() {
external_skeleton_node_cache = ObjectID();
if (has_node(external_skeleton_node)) {
Node *node = get_node(external_skeleton_node);
ERR_FAIL_COND_MSG(!node, "Cannot update external skeleton cache: Node cannot be found!");
ERR_FAIL_NULL_MSG(node, "Cannot update external skeleton cache: Node cannot be found!");

// Make sure it's a skeleton3D
Skeleton3D *sk = Object::cast_to<Skeleton3D>(node);
ERR_FAIL_COND_MSG(!sk, "Cannot update external skeleton cache: Skeleton3D Nodepath does not point to a Skeleton3D node!");
ERR_FAIL_NULL_MSG(sk, "Cannot update external skeleton cache: Skeleton3D Nodepath does not point to a Skeleton3D node!");

external_skeleton_node_cache = node->get_instance_id();
} else {
Expand All @@ -126,11 +126,11 @@ void BoneAttachment3D::_update_external_skeleton_cache() {
parent_attachment->_update_external_skeleton_cache();
if (parent_attachment->has_node(parent_attachment->external_skeleton_node)) {
Node *node = parent_attachment->get_node(parent_attachment->external_skeleton_node);
ERR_FAIL_COND_MSG(!node, "Cannot update external skeleton cache: Parent's Skeleton3D node cannot be found!");
ERR_FAIL_NULL_MSG(node, "Cannot update external skeleton cache: Parent's Skeleton3D node cannot be found!");

// Make sure it's a skeleton3D
Skeleton3D *sk = Object::cast_to<Skeleton3D>(node);
ERR_FAIL_COND_MSG(!sk, "Cannot update external skeleton cache: Parent Skeleton3D Nodepath does not point to a Skeleton3D node!");
ERR_FAIL_NULL_MSG(sk, "Cannot update external skeleton cache: Parent Skeleton3D Nodepath does not point to a Skeleton3D node!");

external_skeleton_node_cache = node->get_instance_id();
external_skeleton_node = get_path_to(node);
Expand Down Expand Up @@ -190,7 +190,7 @@ void BoneAttachment3D::_transform_changed() {
if (override_pose) {
Skeleton3D *sk = _get_skeleton3d();

ERR_FAIL_COND_MSG(!sk, "Cannot override pose: Skeleton not found!");
ERR_FAIL_NULL_MSG(sk, "Cannot override pose: Skeleton not found!");
ERR_FAIL_INDEX_MSG(bone_idx, sk->get_bone_count(), "Cannot override pose: Bone index is out of range!");

Transform3D our_trans = get_transform();
Expand Down
4 changes: 2 additions & 2 deletions scene/3d/camera_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void Camera3D::_notification(int p_what) {
// and Spatial will handle it first, including clearing its reference to the Viewport,
// therefore making it impossible to subclasses to access it
viewport = get_viewport();
ERR_FAIL_COND(!viewport);
ERR_FAIL_NULL(viewport);

bool first_camera = viewport->_camera_3d_add(this);
if (current || first_camera) {
Expand Down Expand Up @@ -454,7 +454,7 @@ Ref<CameraAttributes> Camera3D::get_attributes() const {

void Camera3D::_attributes_changed() {
CameraAttributesPhysical *physical_attributes = Object::cast_to<CameraAttributesPhysical>(attributes.ptr());
ERR_FAIL_COND(!physical_attributes);
ERR_FAIL_NULL(physical_attributes);

fov = physical_attributes->get_fov();
near = physical_attributes->get_near();
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/cpu_particles_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ void CPUParticles3D::_notification(int p_what) {

void CPUParticles3D::convert_from_particles(Node *p_particles) {
GPUParticles3D *gpu_particles = Object::cast_to<GPUParticles3D>(p_particles);
ERR_FAIL_COND_MSG(!gpu_particles, "Only GPUParticles3D nodes can be converted to CPUParticles3D.");
ERR_FAIL_NULL_MSG(gpu_particles, "Only GPUParticles3D nodes can be converted to CPUParticles3D.");

set_emitting(gpu_particles->is_emitting());
set_amount(gpu_particles->get_amount());
Expand Down
4 changes: 2 additions & 2 deletions scene/3d/label_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ void Label3D::_notification(int p_what) {
_im_update();
}
Viewport *viewport = get_viewport();
ERR_FAIL_COND(!viewport);
ERR_FAIL_NULL(viewport);
viewport->connect("size_changed", callable_mp(this, &Label3D::_font_changed));
} break;
case NOTIFICATION_EXIT_TREE: {
Viewport *viewport = get_viewport();
ERR_FAIL_COND(!viewport);
ERR_FAIL_NULL(viewport);
viewport->disconnect("size_changed", callable_mp(this, &Label3D::_font_changed));
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
Expand Down
6 changes: 3 additions & 3 deletions scene/3d/mesh_instance_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Node *MeshInstance3D::create_trimesh_collision_node() {

void MeshInstance3D::create_trimesh_collision() {
StaticBody3D *static_body = Object::cast_to<StaticBody3D>(create_trimesh_collision_node());
ERR_FAIL_COND(!static_body);
ERR_FAIL_NULL(static_body);
static_body->set_name(String(get_name()) + "_col");

add_child(static_body, true);
Expand Down Expand Up @@ -273,7 +273,7 @@ Node *MeshInstance3D::create_convex_collision_node(bool p_clean, bool p_simplify

void MeshInstance3D::create_convex_collision(bool p_clean, bool p_simplify) {
StaticBody3D *static_body = Object::cast_to<StaticBody3D>(create_convex_collision_node(p_clean, p_simplify));
ERR_FAIL_COND(!static_body);
ERR_FAIL_NULL(static_body);
static_body->set_name(String(get_name()) + "_col");

add_child(static_body, true);
Expand Down Expand Up @@ -312,7 +312,7 @@ Node *MeshInstance3D::create_multiple_convex_collisions_node(const Ref<MeshConve

void MeshInstance3D::create_multiple_convex_collisions(const Ref<MeshConvexDecompositionSettings> &p_settings) {
StaticBody3D *static_body = Object::cast_to<StaticBody3D>(create_multiple_convex_collisions_node(p_settings));
ERR_FAIL_COND(!static_body);
ERR_FAIL_NULL(static_body);
static_body->set_name(String(get_name()) + "_col");

add_child(static_body, true);
Expand Down
12 changes: 6 additions & 6 deletions scene/3d/node_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void Node3D::_notification(int p_what) {

switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
ERR_FAIL_COND(!get_tree());
ERR_FAIL_NULL(get_tree());

Node *p = get_parent();
if (p) {
Expand Down Expand Up @@ -186,7 +186,7 @@ void Node3D::_notification(int p_what) {
parent = parent->get_parent();
}

ERR_FAIL_COND(!data.viewport);
ERR_FAIL_NULL(data.viewport);

if (get_script_instance()) {
get_script_instance()->call(SceneStringNames::get_singleton()->_enter_world);
Expand Down Expand Up @@ -379,7 +379,7 @@ Transform3D Node3D::get_relative_transform(const Node *p_parent) const {
return Transform3D();
}

ERR_FAIL_COND_V(!data.parent, Transform3D());
ERR_FAIL_NULL_V(data.parent, Transform3D());

if (p_parent == data.parent) {
return get_transform();
Expand Down Expand Up @@ -743,7 +743,7 @@ bool Node3D::is_set_as_top_level() const {
Ref<World3D> Node3D::get_world_3d() const {
ERR_READ_THREAD_GUARD_V(Ref<World3D>()); // World3D can only be set from main thread, so it's safe to obtain on threads.
ERR_FAIL_COND_V(!is_inside_world(), Ref<World3D>());
ERR_FAIL_COND_V(!data.viewport, Ref<World3D>());
ERR_FAIL_NULL_V(data.viewport, Ref<World3D>());

return data.viewport->find_world_3d();
}
Expand Down Expand Up @@ -977,10 +977,10 @@ void Node3D::_update_visibility_parent(bool p_update_root) {
return;
}
Node *parent = get_node_or_null(visibility_parent_path);
ERR_FAIL_COND_MSG(!parent, "Can't find visibility parent node at path: " + visibility_parent_path);
ERR_FAIL_NULL_MSG(parent, "Can't find visibility parent node at path: " + visibility_parent_path);
ERR_FAIL_COND_MSG(parent == this, "The visibility parent can't be the same node.");
GeometryInstance3D *gi = Object::cast_to<GeometryInstance3D>(parent);
ERR_FAIL_COND_MSG(!gi, "The visibility parent node must be a GeometryInstance3D, at path: " + visibility_parent_path);
ERR_FAIL_NULL_MSG(gi, "The visibility parent node must be a GeometryInstance3D, at path: " + visibility_parent_path);
new_parent = gi ? gi->get_instance() : RID();
} else if (data.parent) {
new_parent = data.parent->data.visibility_parent;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/occluder_instance_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ void OccluderInstance3D::_bake_node(Node *p_node, PackedVector3Array &r_vertices
}

void OccluderInstance3D::bake_single_node(const Node3D *p_node, float p_simplification_distance, PackedVector3Array &r_vertices, PackedInt32Array &r_indices) {
ERR_FAIL_COND(!p_node);
ERR_FAIL_NULL(p_node);

Transform3D xform = p_node->is_inside_tree() ? p_node->get_global_transform() : p_node->get_transform();

Expand Down
17 changes: 8 additions & 9 deletions scene/3d/physics_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ TypedArray<PhysicsBody3D> PhysicsBody3D::get_collision_exceptions() {
void PhysicsBody3D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject3D (such as Area3D or PhysicsBody3D).");
ERR_FAIL_NULL_MSG(collision_object, "Collision exception only works between two nodes that inherit from CollisionObject3D (such as Area3D or PhysicsBody3D).");
PhysicsServer3D::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
}

void PhysicsBody3D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject3D (such as Area3D or PhysicsBody3D).");
ERR_FAIL_NULL_MSG(collision_object, "Collision exception only works between two nodes that inherit from CollisionObject3D (such as Area3D or PhysicsBody3D).");
PhysicsServer3D::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
}

Expand Down Expand Up @@ -379,9 +379,8 @@ AnimatableBody3D::AnimatableBody3D() :
void RigidBody3D::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);

ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(node);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(E->value.in_tree);
Expand All @@ -402,8 +401,8 @@ void RigidBody3D::_body_enter_tree(ObjectID p_id) {
void RigidBody3D::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(node);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(p_id);
ERR_FAIL_COND(!E);
ERR_FAIL_COND(!E->value.in_tree);
Expand All @@ -427,7 +426,7 @@ void RigidBody3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan
Object *obj = ObjectDB::get_instance(objid);
Node *node = Object::cast_to<Node>(obj);

ERR_FAIL_COND(!contact_monitor);
ERR_FAIL_NULL(contact_monitor);
HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(objid);

ERR_FAIL_COND(!body_in && !E);
Expand Down Expand Up @@ -962,7 +961,7 @@ bool RigidBody3D::is_contact_monitor_enabled() const {
}

TypedArray<Node3D> RigidBody3D::get_colliding_bodies() const {
ERR_FAIL_COND_V(!contact_monitor, TypedArray<Node3D>());
ERR_FAIL_NULL_V(contact_monitor, TypedArray<Node3D>());

TypedArray<Node3D> ret;
ret.resize(contact_monitor->body_map.size());
Expand Down
Loading

0 comments on commit 65969dd

Please sign in to comment.