aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-09-10 17:25:03 +0200
committerdec05eba <dec05eba@protonmail.com>2021-09-10 17:25:03 +0200
commit2f5dd509c4a82873b4bf626e55d9c6624ec43dfc (patch)
tree197b9e52b7c50e3fba5143ed90beff4a78b07b28
parent95c189f7445e6deca85130b7b8fa25dc76fabe12 (diff)
Fix indexing when no param is defined
-rw-r--r--src/XpathParser.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/XpathParser.c b/src/XpathParser.c
index b79fe11..b69e47d 100644
--- a/src/XpathParser.c
+++ b/src/XpathParser.c
@@ -36,19 +36,25 @@ static int xpath_parse_param(QuickMediaXpathParser *self, QuickMediaNodeSearchPa
return -3;
result->value = self->tokenizer.string;
+
+ token = quickmedia_xpath_tokenizer_next(&self->tokenizer);
+ if(token != QUICKMEDIA_XPATH_TOKEN_CLOSING_BRACKET)
+ return -4;
+
+ result->defined = 1;
+ result->value_is_glob = contains_glob_char(result->value);
+ return 0;
} else if(token == QUICKMEDIA_XPATH_TOKEN_NUMBER) {
result->index = self->tokenizer.number;
+
+ token = quickmedia_xpath_tokenizer_next(&self->tokenizer);
+ if(token != QUICKMEDIA_XPATH_TOKEN_CLOSING_BRACKET)
+ return -4;
+
+ return 0;
} else {
return -1;
}
-
- token = quickmedia_xpath_tokenizer_next(&self->tokenizer);
- if(token != QUICKMEDIA_XPATH_TOKEN_CLOSING_BRACKET)
- return -4;
-
- result->defined = 1;
- result->value_is_glob = contains_glob_char(result->value);
- return 0;
}
/* ('[' NUMBER ']'))? */