polygon-intersection: Clarify ptr checks for right edges (CID #1160730)

The code is checking a variable is non-NULL after it's already been
dereferenced in an assert.

I'm not certain whether the assert should be conditionalized to only be
tested when right != NULL (which would allow edges_end() to still be
invoked), or if the function should assert right as non-NULL always.

Coverity ID: #1160730
Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
Reviewed-By: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Bryce Harrington 2018-06-12 17:18:58 -07:00
parent 5a4a86c27f
commit 2b6b23fd8c

View file

@ -1107,13 +1107,14 @@ edges_start_or_continue (cairo_bo_edge_t *left,
int top,
cairo_polygon_t *polygon)
{
assert (right != NULL);
assert (right->deferred.other == NULL);
if (left->deferred.other == right)
return;
if (left->deferred.other != NULL) {
if (right != NULL && edges_colinear (left->deferred.other, right)) {
if (edges_colinear (left->deferred.other, right)) {
cairo_bo_edge_t *old = left->deferred.other;
/* continuation on right, extend right to cover both */
@ -1131,7 +1132,7 @@ edges_start_or_continue (cairo_bo_edge_t *left,
edges_end (left, top, polygon);
}
if (right != NULL && ! edges_colinear (left, right)) {
if (! edges_colinear (left, right)) {
left->deferred.top = top;
left->deferred.other = right;
}