summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp5
-rw-r--r--editor/animation_editor.cpp2
-rw-r--r--editor/editor_settings.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp2
-rw-r--r--platform/x11/os_x11.cpp14
-rw-r--r--platform/x11/power_x11.cpp13
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--servers/physics/broad_phase_basic.cpp9
-rw-r--r--servers/visual/visual_server_canvas.cpp14
-rw-r--r--servers/visual/visual_server_scene.cpp7
14 files changed, 39 insertions, 47 deletions
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index e025992c0b..274782c997 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -247,11 +247,8 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target) {
if (p_render_target.is_valid()) {
RasterizerStorageGLES3::RenderTarget *rt = storage->render_target_owner.getornull(p_render_target);
- if (!rt) {
- storage->frame.current_rt = NULL;
- }
- ERR_FAIL_COND(!rt);
storage->frame.current_rt = rt;
+ ERR_FAIL_COND(!rt);
storage->frame.clear_request = false;
glViewport(0, 0, rt->width, rt->height);
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 55542a59a2..5b24baabea 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1646,7 +1646,7 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx, NodePath &r_bas
List<PropertyInfo> pinfo;
if (res.is_valid())
res->get_property_list(&pinfo);
- else
+ else if (node)
node->get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 5b73d83691..f8c37d586d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -253,8 +253,8 @@ static void _create_script_templates(const String &p_path) {
dir->change_dir(p_path);
for (int i = 0; i < keys.size(); i++) {
if (!dir->file_exists(keys[i])) {
- file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE);
- ERR_FAIL_COND(!file);
+ Error err = file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE);
+ ERR_FAIL_COND(err != OK);
file->store_string(templates[keys[i]]);
file->close();
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 0dcabb1776..433145a2ee 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3766,7 +3766,7 @@ bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String &p_targe
void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point) {
child->set_name(path.get_file().get_basename());
- Ref<Texture> texture = Object::cast_to<Texture>(Ref<Texture>(ResourceCache::get(path)).ptr());
+ Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(ResourceCache::get(path)));
Size2 texture_size = texture->get_size();
editor_data->get_undo_redo().add_do_method(parent, "add_child", child);
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 32f5945a10..b51ef6beef 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -822,7 +822,7 @@ public:
}
Node *another = node->get_node(node_path);
- if (!node) {
+ if (!another) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Path does not lead Node!";
return 0;
@@ -1596,7 +1596,7 @@ public:
}
Node *another = node->get_node(node_path);
- if (!node) {
+ if (!another) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Path does not lead Node!";
return 0;
@@ -2241,7 +2241,7 @@ public:
}
Node *another = node->get_node(node_path);
- if (!node) {
+ if (!another) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = RTR("Path does not lead Node!");
return 0;
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 0d65638bb9..5e74c970e3 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -2087,7 +2087,7 @@ public:
}
Node *another = node->get_node(path);
- if (!node) {
+ if (!another) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Path does not lead Node!";
return 0;
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 958eacf2f2..08adc13193 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -535,7 +535,7 @@ public:
}
Node *another = node->get_node(node_path);
- if (!node) {
+ if (!another) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Path does not lead Node!";
return 0;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index dbc3914410..7e712ee325 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -116,24 +116,22 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
/** XLIB INITIALIZATION **/
x11_display = XOpenDisplay(NULL);
+ char *modifiers = NULL;
Bool xkb_dar = False;
if (x11_display) {
XAutoRepeatOn(x11_display);
xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, NULL);
- }
-
- char *modifiers = NULL;
- // Try to support IME if detectable auto-repeat is supported
-
- if (xkb_dar == True) {
+ // Try to support IME if detectable auto-repeat is supported
+ if (xkb_dar == True) {
// Xutf8LookupString will be used later instead of XmbLookupString before
// the multibyte sequences can be converted to unicode string.
#ifdef X_HAVE_UTF8_STRING
- modifiers = XSetLocaleModifiers("");
+ modifiers = XSetLocaleModifiers("");
#endif
+ }
}
if (modifiers == NULL) {
@@ -141,8 +139,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
WARN_PRINT("IME is disabled");
}
modifiers = XSetLocaleModifiers("@im=none");
- }
- if (modifiers == NULL) {
WARN_PRINT("Error setting locale modifiers");
}
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 8e69a2223f..72fa5cf380 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -58,6 +58,7 @@ Adapted from corresponding SDL 2.0 code.
#include <stdio.h>
#include <unistd.h>
+#include "core/error_macros.h"
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -254,9 +255,9 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
this->power_state = POWERSTATE_UNKNOWN;
dirp->change_dir(proc_acpi_battery_path);
- dirp->list_dir_begin();
+ Error err = dirp->list_dir_begin();
- if (dirp == NULL) {
+ if (err != OK) {
return false; /* can't use this interface. */
} else {
node = dirp->get_next();
@@ -268,8 +269,8 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
}
dirp->change_dir(proc_acpi_ac_adapter_path);
- dirp->list_dir_begin();
- if (dirp == NULL) {
+ err = dirp->list_dir_begin();
+ if (err != OK) {
return false; /* can't use this interface. */
} else {
node = dirp->get_next();
@@ -438,9 +439,9 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in
DirAccess *dirp = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
dirp->change_dir(base);
- dirp->list_dir_begin();
+ Error err = dirp->list_dir_begin();
- if (!dirp) {
+ if (err != OK) {
return false;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 2c50b4e854..6e7d1eb8a9 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -215,8 +215,8 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
const Map<int, TextEdit::Text::ColorRegionInfo> &TextEdit::Text::get_color_region_info(int p_line) {
- Map<int, ColorRegionInfo> *cri = NULL;
- ERR_FAIL_INDEX_V(p_line, text.size(), *cri); //enjoy your crash
+ static Map<int, ColorRegionInfo> cri;
+ ERR_FAIL_INDEX_V(p_line, text.size(), cri);
if (text[p_line].width_cache == -1) {
_update_line_cache(p_line);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 20bf818d44..f4e1bff9af 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2868,8 +2868,8 @@ TreeItem *Tree::create_item(TreeItem *p_parent) {
TreeItem *ti = memnew(TreeItem(this));
- ti->cells.resize(columns.size());
ERR_FAIL_COND_V(!ti, NULL);
+ ti->cells.resize(columns.size());
if (p_parent) {
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp
index 05a2e1fdf8..5a54e1f0d9 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics/broad_phase_basic.cpp
@@ -30,17 +30,14 @@
#include "broad_phase_basic.h"
#include "list.h"
#include "print_string.h"
-BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object_, int p_subindex) {
+BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subindex) {
- if (p_object_ == NULL) {
-
- ERR_FAIL_COND_V(p_object_ == NULL, 0);
- }
+ ERR_FAIL_COND_V(p_object == NULL, NULL);
current++;
Element e;
- e.owner = p_object_;
+ e.owner = p_object;
e._static = false;
e.subindex = p_subindex;
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 13517fa409..931e084246 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -1099,13 +1099,15 @@ void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p
if (occluder->polygon.is_valid()) {
LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_polygon);
- if (!occluder_poly)
+ if (!occluder_poly) {
occluder->polygon = RID();
- ERR_FAIL_COND(!occluder_poly);
- occluder_poly->owners.insert(occluder);
- occluder->polygon_buffer = occluder_poly->occluder;
- occluder->aabb_cache = occluder_poly->aabb;
- occluder->cull_cache = occluder_poly->cull_mode;
+ ERR_FAIL_COND(!occluder_poly);
+ } else {
+ occluder_poly->owners.insert(occluder);
+ occluder->polygon_buffer = occluder_poly->occluder;
+ occluder->aabb_cache = occluder_poly->aabb;
+ occluder->cull_cache = occluder_poly->cull_mode;
+ }
}
}
void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index fc9583d793..a0c7420270 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1482,11 +1482,10 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
if (light && p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(E->get()->base)) {
lights_with_shadow[directional_shadow_count++] = E->get();
- }
-
- //add to list
- directional_light_ptr[directional_light_count++] = light->instance;
+ //add to list
+ directional_light_ptr[directional_light_count++] = light->instance;
+ }
}
VSG::scene_render->set_directional_shadow_count(directional_shadow_count);