Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-22 06:50:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-22 06:50:09 +0300
commit799e9c48c1a210386873ae01a0f208675eafffe7 (patch)
treecabbf41a49c072f62336a41c4afde5dd302d2126 /source/blender/editors/curve
parentf6d54bd1eed7a6d6382d237b7d2291c4ba495246 (diff)
comment dead code and fix 2 missing NULL checks (pointer used after NULL check and checking against incorrect pointer before use).
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index db9b82423b0..3eaf53b4bcb 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6096,21 +6096,18 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
Curve *cu= (Curve*)obedit->data;
float vec[3], zvec[3]= {0.0f, 0.0f, 1.0f};
float umat[4][4]= MAT4_UNITY, viewmat[4][4]= MAT4_UNITY;
- float fac, grid;
- int a, b, cutype, stype;
- int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */
+ float fac;
+ int a, b;
+ const float grid= v3d ? v3d->grid : 1.0f;
+ const int cutype= (type & CU_TYPE); // poly, bezier, nurbs, etc
+ const int stype= (type & CU_PRIMITIVE);
+ const int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */
if(rv3d) {
copy_m4_m4(viewmat, rv3d->viewmat);
VECCOPY(zvec, rv3d->viewinv[2]);
}
-
- cutype= type & CU_TYPE; // poly, bezier, nurbs, etc
- stype= type & CU_PRIMITIVE;
-
- if (v3d) grid = v3d->grid;
- else grid = 1.0;
-
+
setflagsNurb(editnurb, 0);
/* these types call this function to return a Nurb */
@@ -6432,6 +6429,10 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
break;
+
+ default: /* should never happen */
+ BLI_assert(!"invalid nurbs type");
+ return NULL;
}
/* always do: */