diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb1487c5a..4b4eb477a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page. atlas is resized or rebuilt. This way it's easy to track when texture coordinates has changed. - Added `Text.visible` (bool) property to control the visibility of text objects. +- Fixed an issue causing points and lines to draw random primitives when + passing in an empty list. ## 3.3.0 diff --git a/arcade/draw/line.py b/arcade/draw/line.py index daf5c244be..07e3ed5452 100644 --- a/arcade/draw/line.py +++ b/arcade/draw/line.py @@ -112,6 +112,8 @@ def draw_lines(point_list: Point2List, color: RGBOrA255, line_width: float = 1) line_pos_array = array.array("f", (v for point in point_list for v in point)) num_points = len(point_list) + if num_points == 0: + return # Grow buffer until large enough to hold all our data goal_buffer_size = num_points * 3 * 4 diff --git a/arcade/draw/point.py b/arcade/draw/point.py index 9898f66527..d5312e3f02 100644 --- a/arcade/draw/point.py +++ b/arcade/draw/point.py @@ -64,6 +64,8 @@ def draw_points(point_list: Point2List, color: RGBOrA255, size: float = 1.0) -> # Get # of points and translate Python tuples to a C-style array num_points = len(point_list) + if num_points == 0: + return point_array = array.array("f", (v for point in point_list for v in point)) # Resize buffer