diff --git a/panda/src/express/pointerToArray.I b/panda/src/express/pointerToArray.I index 032972d174..6f95abe1bd 100644 --- a/panda/src/express/pointerToArray.I +++ b/panda/src/express/pointerToArray.I @@ -566,6 +566,10 @@ template INLINE void PointerToArray:: set_subdata(size_type n, size_type count, const string &data) { nassertv((data.length() % sizeof(Element)) == 0); + nassertv(n <= size() && n + count <= size()); + nassertd((this->_void_ptr) != NULL) { + ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); + } size_type ncount = data.length() / sizeof(Element); if (ncount < count) { // Reduce the array.