summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/select/select.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/select/select.c b/src/select/select.c
index 1d6740f..4159607 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -687,18 +687,21 @@ css_error match_universal_combinator(css_select_ctx *ctx, css_combinator type,
break;
}
- /* Match its details */
- error = match_details(ctx, n, detail, state, &match);
- if (error != CSS_OK)
- return error;
+ if (n != NULL) {
+ /* Match its details */
+ error = match_details(ctx, n, detail, state, &match);
+ if (error != CSS_OK)
+ return error;
- /* If we found a match, use it */
- if (match == true)
- break;
+ /* If we found a match, use it */
+ if (match == true)
+ break;
- /* Wanted the parent, but it didn't match, so stop looking */
- if (type == CSS_COMBINATOR_PARENT)
- n = NULL;
+ /* Wanted the parent, but it didn't match,
+ * so stop looking */
+ if (type == CSS_COMBINATOR_PARENT)
+ n = NULL;
+ }
} while (n != NULL);
*next_node = n;