From d7ba3b73a950597b22e26468988734d8ae5d4b92 Mon Sep 17 00:00:00 2001 From: Cory Petkovsek <632766+tinmanjuggernaut@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:20:45 +0800 Subject: [PATCH] Clarify invalid RID errors in Server free() functions. --- modules/bullet/bullet_physics_server.cpp | 4 ++-- modules/navigation/godot_navigation_server.cpp | 4 ++-- servers/physics/physics_server_sw.cpp | 4 ++-- servers/physics_2d/physics_2d_server_sw.cpp | 4 ++-- servers/visual/visual_server_raster.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 90a9adc837e5..f9879c5c50ea 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -1481,7 +1481,7 @@ bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis void BulletPhysicsServer::free(RID p_rid) { if (!p_rid.is_valid()) { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("PhysicsServer attempted to free a NULL RID."); return; } @@ -1540,7 +1540,7 @@ void BulletPhysicsServer::free(RID p_rid) { bulletdelete(space); } else { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("RID not found by PhysicsServer."); } } diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index dbb1256999dd..d835cd13d6d0 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -554,7 +554,7 @@ COMMAND_4(agent_set_callback, RID, p_agent, Object *, p_receiver, StringName, p_ COMMAND_1(free, RID, p_object) { if (!p_object.is_valid()) { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("NavigationServer attempted to free a NULL RID."); return; } if (map_owner.owns(p_object)) { @@ -605,7 +605,7 @@ COMMAND_1(free, RID, p_object) { memdelete(agent); } else { - ERR_FAIL_COND("Invalid RID."); + ERR_FAIL_COND("RID not found by NavigationServer."); } } diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 40eebba4bdc0..afc10b05b7aa 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -1200,7 +1200,7 @@ bool PhysicsServerSW::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_a void PhysicsServerSW::free(RID p_rid) { if (!p_rid.is_valid()) { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("PhysicsServer attempted to free a NULL RID."); return; } @@ -1279,7 +1279,7 @@ void PhysicsServerSW::free(RID p_rid) { memdelete(joint); } else { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("RID not found by PhysicsServer."); } }; diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index bf175d13f24e..284e8f167d01 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -1122,7 +1122,7 @@ Physics2DServer::JointType Physics2DServerSW::joint_get_type(RID p_joint) const void Physics2DServerSW::free(RID p_rid) { if (!p_rid.is_valid()) { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("PhysicsServer attempted to free a NULL RID."); return; } @@ -1195,7 +1195,7 @@ void Physics2DServerSW::free(RID p_rid) { memdelete(joint); } else { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("RID not found by PhysicsServer."); } }; diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 954f13fc7181..0a083da4ca1b 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -66,7 +66,7 @@ void VisualServerRaster::_draw_margins() { void VisualServerRaster::free(RID p_rid) { if (!p_rid.is_valid()) { - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("VisualServer attempted to free a NULL RID."); return; } @@ -86,7 +86,7 @@ void VisualServerRaster::free(RID p_rid) { return; } - ERR_FAIL_MSG("Invalid RID."); + ERR_FAIL_MSG("RID not found by VisualServer."); } /* EVENT QUEUING */