Commit 1f556007 authored by Romain Vimont's avatar Romain Vimont Committed by Romain Vimont

Assert non-negative block offsets

Assert that BlockOffset::with_offset() never wraps due to negative
offsets.
parent 9ef63ebf
......@@ -1245,6 +1245,8 @@ impl BlockOffset {
pub fn with_offset(self, col_offset: isize, row_offset: isize) -> BlockOffset {
let x = self.x as isize + col_offset;
let y = self.y as isize + row_offset;
debug_assert!(x >= 0);
debug_assert!(y >= 0);
BlockOffset {
x: x as usize,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment