Commit 7a385c1e authored by Heiko Lewin's avatar Heiko Lewin
Browse files

cairo-bentley-ottmann.c: Added NULL checks

parent 48194cf0
Pipeline #260490 passed with stages
in 23 minutes and 28 seconds
......@@ -544,7 +544,7 @@ sweep_line_delete_edge (sweep_line_t *sweep, edge_t *edge)
{
if (edge->right != NULL) {
edge_t *next = edge->next;
if (next->x == edge->x) {
if (next && next->x == edge->x) {
next->top = edge->top;
next->right = edge->right;
} else
......@@ -554,8 +554,8 @@ sweep_line_delete_edge (sweep_line_t *sweep, edge_t *edge)
if (sweep->cursor == edge)
sweep->cursor = edge->prev;
edge->prev->next = edge->next;
edge->next->prev = edge->prev;
if(edge->prev) edge->prev->next = edge->next;
if(edge->next) edge->next->prev = edge->prev;
}
static inline cairo_bool_t
......@@ -564,10 +564,17 @@ sweep_line_delete (sweep_line_t *sweep, rectangle_t *rectangle)
cairo_bool_t update;
update = TRUE;
if (sweep->fill_rule == CAIRO_FILL_RULE_WINDING &&
rectangle->left.prev->dir == rectangle->left.dir)
if (sweep->fill_rule == CAIRO_FILL_RULE_WINDING)
{
update = rectangle->left.next != &rectangle->right;
if(rectangle->left.prev == NULL)
{
update = FALSE; /* no change of direction */
}
else if(rectangle->left.prev->dir == rectangle->left.dir)
{
update = rectangle->left.next != &rectangle->right; /* no right side, so no change of direction */
}
}
sweep_line_delete_edge (sweep, &rectangle->left);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment