diff options
Diffstat (limited to 'lib/rust/src')
-rw-r--r-- | lib/rust/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rust/src/lib.rs b/lib/rust/src/lib.rs index bfeaee4..246a89f 100644 --- a/lib/rust/src/lib.rs +++ b/lib/rust/src/lib.rs @@ -18,8 +18,8 @@ impl<T> Grid<T> { (0..) .map(move |n| { self.grid - .get(usize::try_from(y + n * dy).unwrap()) - .and_then(|row| row.get(usize::try_from(x + n * dx).unwrap())) + .get(usize::try_from(y + n * dy).ok()?) + .and_then(|row| row.get(usize::try_from(x + n * dx).ok()?)) }) .take_while(Option::is_some) .flatten() |