From 2c3b7fae5aadf5b1aebd6c6183cb14696e60c349 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sun, 25 Jul 2021 20:38:15 +0100 Subject: [PATCH] Error more explicitely in case trying to serialize an empty block --- streams/voxel_block_serializer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/streams/voxel_block_serializer.cpp b/streams/voxel_block_serializer.cpp index b8b98b2a..1c17a73e 100644 --- a/streams/voxel_block_serializer.cpp +++ b/streams/voxel_block_serializer.cpp @@ -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) { 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; const size_t data_size = get_size_in_bytes(voxel_buffer, metadata_size);