Error more explicitely in case trying to serialize an empty block

master
Marc Gilleron 2021-07-25 20:38:15 +01:00
parent 466bc41ab8
commit 2c3b7fae5a
1 changed files with 2 additions and 0 deletions

View File

@ -186,6 +186,8 @@ size_t get_size_in_bytes(const VoxelBuffer &buffer, size_t &metadata_size) {
VoxelBlockSerializerInternal::SerializeResult VoxelBlockSerializerInternal::serialize(const VoxelBuffer &voxel_buffer) { VoxelBlockSerializerInternal::SerializeResult VoxelBlockSerializerInternal::serialize(const VoxelBuffer &voxel_buffer) {
VOXEL_PROFILE_SCOPE(); VOXEL_PROFILE_SCOPE();
// Cannot serialize an empty block
ERR_FAIL_COND_V(voxel_buffer.get_size().volume() == 0, SerializeResult(_data, false));
size_t metadata_size = 0; size_t metadata_size = 0;
const size_t data_size = get_size_in_bytes(voxel_buffer, metadata_size); const size_t data_size = get_size_in_bytes(voxel_buffer, metadata_size);