summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/Array.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/Array.h')
-rw-r--r--src/libs/engine/Array.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libs/engine/Array.h b/src/libs/engine/Array.h
index 6b56ecc5..6ec51b89 100644
--- a/src/libs/engine/Array.h
+++ b/src/libs/engine/Array.h
@@ -46,10 +46,12 @@ public:
Array(size_t size, const Array<T>* contents) : m_size(size), m_top(size+1) {
m_elems = new T[size];
- if (size <= contents->size())
- memcpy(m_elems, contents->m_elems, size * sizeof(T));
- else
- memcpy(m_elems, contents->m_elems, contents->size() * sizeof(T));
+ if (contents) {
+ if (size <= contents->size())
+ memcpy(m_elems, contents->m_elems, size * sizeof(T));
+ else
+ memcpy(m_elems, contents->m_elems, contents->size() * sizeof(T));
+ }
}
~Array() {