bugfix
authorCampbell Barton <ideasman42@gmail.com>
Sat, 25 Feb 2012 09:06:17 +0000 (09:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 25 Feb 2012 09:06:17 +0000 (09:06 +0000)
* ntreeCompositExecTree accessed 'ntree' before NULL check.
* BM_face_triangulate accessed 'f' before NULL check.

also quiet warning in BKE_text_to_curve() and add a check for BMesh bridge loops so it knows quicker if it can copy loop data or not.

source/blender/blenkernel/intern/font.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/operators/bmo_connect.c
source/blender/nodes/composite/node_composite_tree.c

index 0761b8f14c7a1f7f153cbe42035ee3d0d1df57af..f45899ff3654a47d6a79b861ffd3816f316955b5 100644 (file)
@@ -808,8 +808,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
                                if(linedata2[i]>1)
                                        linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
                        for (i=0; i<=slen; i++) {
-                               for (j=i; (mem[j]) && (mem[j]!='\n') && 
-                                                 (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
+                               for (j=i; (!ELEM3(mem[j], '\0', '\n', '\r')) && (chartransdata[j].dobreak == 0) && (j < slen); j++) {
+                                       /* do nothing */
+                               }
+
 //                             if ((mem[j]!='\r') && (mem[j]!='\n') && (mem[j])) {
                                        ct->xof+= ct->charnr*linedata[ct->linenr];
 //                             }
index 79d229aec1b18a18125ba320f674dd3f9ab8b1b5..19b13a00f6da17f1546c4887eb515e5c3ed401ae 100644 (file)
@@ -861,13 +861,13 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
                        f = BM_face_split(bm, l_iter->f, l_iter->prev->v,
                                          l_iter->next->v,
                                          &newl, NULL);
-                       copy_v3_v3(f->no, l_iter->f->no);
 
-                       if (!f) {
+                       if (UNLIKELY(!f)) {
                                fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
                                break;
                        }
 
+                       copy_v3_v3(f->no, l_iter->f->no);
                        BMO_elem_flag_enable(bm, newl->e, newedge_oflag);
                        BMO_elem_flag_enable(bm, f, newface_oflag);
                        
index 2beed279f4b73f274ca67fb703feda8e198ccaa8..ad15b7030417c6e7eb80bc0d07df60dd95aad197 100644 (file)
@@ -167,16 +167,20 @@ static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BM
        BMIter liter;
        BMLoop *l;
 
-       BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v1) {
-               if (l->prev->v == v2) {
-                       *l1 = l;
-                       *l2 = l->prev;
-                       return;
-               }
-               else if (l->next->v == v2) {
-                       *l1 = l;
-                       *l2 = l->next;
-                       return;
+       if ((v1->e && v1->e->l) &&
+           (v2->e && v2->e->l))
+       {
+               BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v1) {
+                       if (l->prev->v == v2) {
+                               *l1 = l;
+                               *l2 = l->prev;
+                               return;
+                       }
+                       else if (l->next->v == v2) {
+                               *l1 = l;
+                               *l2 = l->next;
+                               return;
+                       }
                }
        }
 
index 52dc364e590f721cd2c9a6557239caa730abb49f..8257b850010084f48c3b8c207bca85cf825ffe1d 100644 (file)
@@ -566,10 +566,12 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
        ListBase threads;
        ThreadData thdata;
        int totnode, curnode, rendering= 1, n;
-       bNodeTreeExec *exec= ntree->execdata;
-       
+       bNodeTreeExec *exec;
+
        if(ntree==NULL) return;
-       
+
+       exec = ntree->execdata;
+
        if(do_preview)
                ntreeInitPreview(ntree, 0, 0);