Fix many errors found by PVS-Studio
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
This commit is contained in:
parent
aa08ef2bed
commit
cb01268562
10 changed files with 25 additions and 23 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue