Browse Source

mathutil: error instead of infinite loop if triangulation failed

Fixes #985
rdb 5 years ago
parent
commit
9c4cb28805
1 changed files with 4 additions and 0 deletions
  1. 4 0
      panda/src/mathutil/triangulator.cxx

+ 4 - 0
panda/src/mathutil/triangulator.cxx

@@ -150,7 +150,11 @@ triangulate() {
   }
   */
 
+  int attempts = 0;
+
   while (construct_trapezoids(num_segments) != 0) {
+    nassertv_always(attempts++ < 100);
+
     // If there's an error, re-shuffle the index and try again.
     Randomizer randomizer;
     for (i = 0; i < num_segments; ++i) {