summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorqarmin <mikrutrafal54@gmail.com>2019-08-07 12:54:30 +0200
committerqarmin <mikrutrafal54@gmail.com>2019-08-07 12:54:30 +0200
commite0b5b218638df5b7b2998233182a7d8a1118e717 (patch)
tree0de2f04fbb41472d3bd9b43141f26193cb062be9 /servers
parent045ab51ae50139e645958149c6d6d354026ccdd4 (diff)
Add some code changes/fixes proposed by Coverity and Clang Tidy
Diffstat (limited to 'servers')
-rw-r--r--servers/physics/space_sw.cpp6
-rw-r--r--servers/physics_2d/body_2d_sw.cpp2
-rw-r--r--servers/physics_2d/space_2d_sw.cpp6
-rw-r--r--servers/visual/visual_server_viewport.cpp1
4 files changed, 6 insertions, 9 deletions
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index f3a4cbed24..410b6e59a0 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -348,11 +348,9 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
cbk.max = p_result_max;
cbk.amount = 0;
cbk.ptr = r_results;
- CollisionSolverSW::CallbackResult cbkres = NULL;
+ CollisionSolverSW::CallbackResult cbkres = PhysicsServerSW::_shape_col_cbk;
- PhysicsServerSW::CollCbkData *cbkptr = NULL;
- cbkptr = &cbk;
- cbkres = PhysicsServerSW::_shape_col_cbk;
+ PhysicsServerSW::CollCbkData *cbkptr = &cbk;
for (int i = 0; i < amount; i++) {
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 5dff655ea1..b9ebd30021 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -608,7 +608,7 @@ void Body2DSW::call_queries() {
set_force_integration_callback(0, StringName());
} else {
Variant::CallError ce;
- if (fi_callback->callback_udata.get_type()) {
+ if (fi_callback->callback_udata.get_type() != Variant::NIL) {
obj->call(fi_callback->method, vp, 2, ce);
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 7c89c43f36..2778775446 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -330,11 +330,9 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
cbk.amount = 0;
cbk.passed = 0;
cbk.ptr = r_results;
- CollisionSolver2DSW::CallbackResult cbkres = NULL;
+ CollisionSolver2DSW::CallbackResult cbkres = Physics2DServerSW::_shape_col_cbk;
- Physics2DServerSW::CollCbkData *cbkptr = NULL;
- cbkptr = &cbk;
- cbkres = Physics2DServerSW::_shape_col_cbk;
+ Physics2DServerSW::CollCbkData *cbkptr = &cbk;
for (int i = 0; i < amount; i++) {
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 86c5227f30..0863d5c2e3 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -85,6 +85,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
if (!p_viewport->hide_canvas && !p_viewport->disable_environment && VSG::scene->scenario_owner.owns(p_viewport->scenario)) {
VisualServerScene::Scenario *scenario = VSG::scene->scenario_owner.get(p_viewport->scenario);
+ ERR_FAIL_COND(!scenario);
if (VSG::scene_render->is_environment(scenario->environment)) {
scenario_draw_canvas_bg = VSG::scene_render->environment_get_background(scenario->environment) == VS::ENV_BG_CANVAS;