better assertions

This commit is contained in:
David Rose 2009-03-24 01:17:33 +00:00
parent 4683c4c3c5
commit fd51c9b27e

View File

@ -566,6 +566,10 @@ template<class Element>
INLINE void PointerToArray<Element>::
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<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
}
size_type ncount = data.length() / sizeof(Element);
if (ncount < count) {
// Reduce the array.