summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-11-28 14:08:50 +0100
committerGitHub <noreply@github.com>2018-11-28 14:08:50 +0100
commit06db076fc6c49fb585e753bd327ce1a80b0bf7d5 (patch)
tree019e3bf7661e3faa67dcf501511ff9d07349bb1d /core/variant_op.cpp
parent39028cc161048ffccd0fae8677c523da648311a5 (diff)
parentcb01268562a47e6a1c32559f58fbadd46e52d304 (diff)
Merge pull request #24025 from aaronfranke/analyzer-errors
Fix many errors found by PVS-Studio
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];