Skip to content

Commit

Permalink
Added asserts to catch saving and loading of a model with zero size
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbinks authored and jpaver committed Jun 11, 2023
1 parent 4cd9067 commit f7c760b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ogt_vox.h
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@
_vox_file_read_uint32(fp, &size_x);
_vox_file_read_uint32(fp, &size_y);
_vox_file_read_uint32(fp, &size_z);
ogt_assert(size_x && size_y && size_z, "SIZE chunk has zero size");
break;
}
case CHUNK_ID_XYZI:
Expand Down Expand Up @@ -2275,6 +2276,7 @@
_vox_file_write_uint32(fp, 0);

// write the SIZE chunk payload
ogt_assert(model->size_x && model->size_y && model->size_z, "model has zero size");
_vox_file_write_uint32(fp, model->size_x);
_vox_file_write_uint32(fp, model->size_y);
_vox_file_write_uint32(fp, model->size_z);
Expand Down

0 comments on commit f7c760b

Please sign in to comment.