We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2eb2f7e commit b1bc851Copy full SHA for b1bc851
cairo/src/region.rs
@@ -176,6 +176,8 @@ impl Region {
176
#[doc(alias = "get_rectangle")]
177
#[doc(alias = "cairo_region_get_rectangle")]
178
pub fn rectangle(&self, nth: i32) -> RectangleInt {
179
+ let total_rectangles = self.num_rectangles();
180
+ assert!(nth >= 0 && nth < total_rectangles, "nth is out of range");
181
unsafe {
182
let rectangle: RectangleInt = ::std::mem::zeroed();
183
ffi::cairo_region_get_rectangle(self.0.as_ptr(), nth, rectangle.to_raw_none());
0 commit comments