summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2018-11-27 21:58:00 -0500
committerAaron Franke <arnfranke@yahoo.com>2018-11-28 05:03:24 -0500
commitcb01268562a47e6a1c32559f58fbadd46e52d304 (patch)
tree8466e05cbf670863759899e0fd7d67d6a44ca1cb /core/variant_op.cpp
parentaa08ef2bed34510cfb18ce3e1e5cdd9c009981be (diff)
Fix many errors found by PVS-Studio
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index d193858966..9f172f0d57 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -2149,7 +2149,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
int idx = p_index;
if (idx < 0)
idx += 4;
- if (idx >= 0 || idx < 4) {
+ if (idx >= 0 && idx < 4) {
Color *v = reinterpret_cast<Color *>(_data._mem);
(*v)[idx] = p_value;
valid = true;
@@ -2524,7 +2524,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
int idx = p_index;
if (idx < 0)
idx += 4;
- if (idx >= 0 || idx < 4) {
+ if (idx >= 0 && idx < 4) {
const Color *v = reinterpret_cast<const Color *>(_data._mem);
valid = true;
return (*v)[idx];