A community-maintained Python framework for creating mathematical animations.
exception add if new_rings is none (#3574)
Hydromel Victor Doledji4e3cfd207a16
diff --git a/manim/utils/space_ops.py b/manim/utils/space_ops.pyindex 973502aaf..3e90deef2 100644--- a/manim/utils/space_ops.py+++ b/manim/utils/space_ops.py@@ -755,9 +755,14 @@ def earclip_triangulation(verts: np.ndarray, ring_ends: list) -> list:# Move the ring which j belongs to from the# attached list to the detached list- new_ring = next(filter(lambda ring: ring[0] <= j < ring[-1], detached_rings))- detached_rings.remove(new_ring)- attached_rings.append(new_ring)+ new_ring = next(+ (ring for ring in detached_rings if ring[0] <= j < ring[-1]), None+ )+ if new_ring is not None:+ detached_rings.remove(new_ring)+ attached_rings.append(new_ring)+ else:+ raise Exception("Could not find a ring to attach")# Setup linked listafter = []