Selaa lähdekoodia

Fix for avoid a zero division on _StringTable::resize.

LuisAntonRebollo 11 vuotta sitten
vanhempi
commit
e6e225e081
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      Engine/source/core/stringTable.cpp

+ 4 - 1
Engine/source/core/stringTable.cpp

@@ -195,8 +195,11 @@ StringTableEntry _StringTable::lookupn(const char* val, S32 len, const bool  cas
 }
 
 //--------------------------------------
-void _StringTable::resize(const U32 newSize)
+void _StringTable::resize(const U32 _newSize)
 {
+   /// avoid a possible 0 division
+   const U32 newSize = _newSize ? _newSize : 1;
+
    Node *head = NULL, *walk, *temp;
    U32 i;
    // reverse individual bucket lists