diff libinterp/corefcn/gl-render.cc @ 25419:7361fd8aed86

Fix segmentation fault with last change (bug #47677). * gl-renderer.cc (opengl_renderer::draw_patch): Check size of list before dereferencing.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 31 May 2018 22:46:09 +0200
parents 762eb2e33a7f
children 13b1b9a0d9c5
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Mon Jul 18 18:33:48 2016 +0200
+++ b/libinterp/corefcn/gl-render.cc	Thu May 31 22:46:09 2018 +0200
@@ -3143,10 +3143,10 @@
                 if (clip_f(i))
                   continue;
 
-                bool check_coplanarity = false;
-                if (has_z && count_f(i) > 3)
+                bool is_non_planar = false;
+                if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1)
                   {
-                    check_coplanarity = true;
+                    is_non_planar = true;
                     it2 = (*it1).end ();
                     it2--;
                   }
@@ -3154,7 +3154,7 @@
                 // loop over planar subsets of face
                 do
                   {
-                    if (check_coplanarity)
+                    if (is_non_planar)
                       {
                         i_end = *it2;
                         if (it2 == (*it1).begin ())
@@ -3224,7 +3224,7 @@
                     tess.end_polygon ();
                   } while (i_start > 0);
 
-                if (check_coplanarity)
+                if (is_non_planar)
                   it1++;
               }
 
@@ -3285,7 +3285,7 @@
             for (int i = 0; i < nf; i++)
               {
                 bool is_non_planar = false;
-                if ((has_z && count_f(i) > 3) && (*it1).front () != count_f(i))
+                if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1)
                   is_non_planar = true;
                 if (clip_f(i) || is_non_planar)
                   {
@@ -3360,7 +3360,7 @@
                     tess.end_contour ();
                     tess.end_polygon ();
                   }
-                if (has_z && count_f(i) > 3)
+                if (is_non_planar)
                   it1++;
               }