aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/array.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/common/array.h b/common/array.h
index 26ee2afbcc..87325d60d3 100644
--- a/common/array.h
+++ b/common/array.h
@@ -264,9 +264,13 @@ protected:
void allocCapacity(uint capacity) {
_capacity = capacity;
- _storage = new T[capacity];
- if (!_storage)
- ::error("Common::Array: failure to allocate %d bytes", capacity);
+ if (capacity) {
+ _storage = new T[capacity];
+ if (!_storage)
+ ::error("Common::Array: failure to allocate %d bytes", capacity);
+ } else {
+ _storage = 0;
+ }
}
/**