summaryrefslogtreecommitdiff
path: root/library/include/BitArray.h
diff options
context:
space:
mode:
Diffstat (limited to 'library/include/BitArray.h')
-rw-r--r--library/include/BitArray.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/include/BitArray.h b/library/include/BitArray.h
index fd9bd98f..ff68ea1d 100644
--- a/library/include/BitArray.h
+++ b/library/include/BitArray.h
@@ -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;
}