Selaa lähdekoodia

Merge pull request #1180 from Azaezel/alpha41/awryArrays

don't allow setting a key or value on -1 index
Brian Roberts 1 vuosi sitten
vanhempi
commit
199ef84fcb
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      Engine/source/console/arrayObject.cpp

+ 2 - 2
Engine/source/console/arrayObject.cpp

@@ -450,7 +450,7 @@ void ArrayObject::append(ArrayObject* obj)
 
 void ArrayObject::setKey( const String &key, S32 index )
 {
-   if ( index >= mArray.size() )
+   if (index >= mArray.size() || index < 0)
       return;
 
    mArray[index].key = key;
@@ -460,7 +460,7 @@ void ArrayObject::setKey( const String &key, S32 index )
 
 void ArrayObject::setValue( const String &value, S32 index )
 {
-   if ( index >= mArray.size() )
+   if (index >= mArray.size() || index < 0)
       return;
    
    mArray[index].value = value;