Fix wrong assumptions in lua wrapper for BitArray.

develop
Alexander Gavrilov 2012-09-02 17:18:01 +04:00
parent 67630776ee
commit 3b8e3d1459
2 changed files with 3 additions and 3 deletions

@ -64,7 +64,7 @@ namespace DFHack
if (newsize == size)
return;
uint8_t* mem = (uint8_t *) realloc(bits, newsize);
if(!mem)
if(!mem && newsize != 0)
throw std::bad_alloc();
bits = mem;
if (newsize > size)
@ -207,7 +207,7 @@ namespace DFHack
else
{
T* mem = (T*) realloc(m_data, sizeof(T)*new_size);
if(!mem)
if(!mem && new_size != 0)
throw std::bad_alloc();
m_data = mem;
}

@ -390,7 +390,7 @@ namespace df
}
virtual bool resize(void *ptr, int size) {
((container*)ptr)->resize(size);
((container*)ptr)->resize(size*8);
return true;
}