diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl index 14bed170..536fe065 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl @@ -177,12 +177,18 @@ namespace PolyVox void SimpleVolume::resize(const Region& regValidRegion, uint16_t uBlockSideLength) { //Debug mode validation - assert(uBlockSideLength > 0); + assert(uBlockSideLength >= 8); + assert(uBlockSideLength <= 256); + assert(isPowerOf2(uBlockSideLength)); //Release mode validation - if(uBlockSideLength == 0) + if(uBlockSideLength < 8) { - throw std::invalid_argument("Block side length cannot be zero."); + throw std::invalid_argument("Block side length should be at least 8"); + } + if(uBlockSideLength > 256) + { + throw std::invalid_argument("Block side length should not be more than 256"); } if(!isPowerOf2(uBlockSideLength)) {