add some missing NULL checks, a few parts of the code used a pointer then checked it for NULL after.

also made it more clear that some areas assume the pointer isnt null (remove redundant NULL checks).
This commit is contained in:
Campbell Barton
2012-09-11 02:18:27 +00:00
parent 652f64762c
commit a0ae47f06c
11 changed files with 30 additions and 33 deletions

View File

@@ -536,18 +536,18 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
const MT_Vector3 pnorm(transform.getBasis()[2]);
// unneeded: const MT_Scalar pval = transform.getOrigin()[2];
vector<polygonSlot> slots(totpoly);
vector<polygonSlot> poly_slots(totpoly);
/* get indices and z into temporary array */
for (j=0; j<totpoly; j++)
slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm);
poly_slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm);
/* sort (stable_sort might be better, if flickering happens?) */
std::sort(slots.begin(), slots.end(), backtofront());
std::sort(poly_slots.begin(), poly_slots.end(), backtofront());
/* get indices from temporary array again */
for (j=0; j<totpoly; j++)
slots[j].set(it.index, j*nvert, nvert);
poly_slots[j].set(it.index, j*nvert, nvert);
}
}