Fixed infinite loop when using SetArraySize() or 2nd parameter of CreateArray().
authorPhong Dang <teame06@gmail.com>
Sat Jul 28 20:01:30 2007 +0000 (2007-07-28)
changeset 11988be738470896
parent 1197 d8e2d3c4643b
child 1199 1643c2d8f570
Fixed infinite loop when using SetArraySize() or 2nd parameter of CreateArray().
core/CellArray.h
     1.1 --- a/core/CellArray.h	Sat Jul 28 02:10:11 2007 +0000
     1.2 +++ b/core/CellArray.h	Sat Jul 28 20:01:30 2007 +0000
     1.3 @@ -112,7 +112,14 @@
     1.4  			m_Size = count;
     1.5  			return true;
     1.6  		}
     1.7 -		return GrowIfNeeded(m_Size - count);
     1.8 +
     1.9 +		if(!GrowIfNeeded(count - m_Size))
    1.10 +		{
    1.11 +			return false;
    1.12 +		}
    1.13 +
    1.14 +		m_Size = count;
    1.15 +		return true;
    1.16  	}
    1.17  private:
    1.18  	bool GrowIfNeeded(size_t count)