Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible incompleteness #268

Open
YichiZhang0613 opened this issue Feb 24, 2024 · 0 comments
Open

Possible incompleteness #268

YichiZhang0613 opened this issue Feb 24, 2024 · 0 comments

Comments

@YichiZhang0613
Copy link

As you mentioned in documentation, I think the index should be checked whether it is out of bounds before directly used as polygon.points[index].
turtle-master/src/renderer_server/renderer/display_list.rs

/// Panics if the given handle does not refer to a polygon primitive or if the given index is
    /// out of bounds.
    pub fn polygon_update(&mut self, handle: PrimHandle, index: usize, point: Point) {
        let prim = self.items.get_mut(&handle).expect("bug: invalid handle");
        let polygon = prim.as_polygon_mut()
            .expect("bug: attempt to update a point in a draw primitive that was not a polygon");

        // This will panic if the index is out of bounds
        polygon.points[index] = point;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant