diff --git a/src/maxicode/detector.rs b/src/maxicode/detector.rs index 18b3244..f22c00f 100644 --- a/src/maxicode/detector.rs +++ b/src/maxicode/detector.rs @@ -281,7 +281,9 @@ impl Circle<'_> { // count left while { let point = get_point(self.center, (x, y), rotation); - !self.image.get(point.x as u32, point.y as u32) && x > 0 + !self.image.check_in_bounds(point.x as u32, point.y as u32) + && !self.image.get(point.x as u32, point.y as u32) + && x > 0 } { x -= 1; length += 1; @@ -293,7 +295,8 @@ impl Circle<'_> { // count right while { let point = get_point(self.center, (x, y), rotation); - !self.image.get(point.x as u32, point.y as u32) + !self.image.check_in_bounds(point.x as u32, point.y as u32) + && !self.image.get(point.x as u32, point.y as u32) } { x += 1; length += 1;