summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2018-06-12 17:18:58 -0700
committerBryce Harrington <bryce@bryceharrington.org>2018-06-13 15:21:50 -0700
commit2b6b23fd8cfae768145e9a9f1f27eb0415e2a617 (patch)
treeeab4d96af29dd00f63a886ef43c6c423f17fa3e4
parent5a4a86c27f733645a2276d0a3bd2494e73b3dc88 (diff)
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>
-rw-r--r--src/cairo-polygon-intersect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c
index 9c1777f4f..001e55ee0 100644
--- a/src/cairo-polygon-intersect.c
+++ b/src/cairo-polygon-intersect.c
@@ -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;
}