diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-01-06 14:48:46 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-01-06 14:48:46 -0800 |
commit | bf3e4126b28d1327f047e6047cd4638d7a129730 (patch) | |
tree | 56ec84cb2d6a6940731668b48561693f21e3eda9 /builtin_test.cpp | |
parent | 8a357e18669c7eb1f086d69ba770b01b1191e222 (diff) |
Fix for builtin_test crash
Diffstat (limited to 'builtin_test.cpp')
-rw-r--r-- | builtin_test.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin_test.cpp b/builtin_test.cpp index 6f7e5acf..79251252 100644 --- a/builtin_test.cpp +++ b/builtin_test.cpp @@ -334,11 +334,12 @@ expression *test_parser::parse_combining_expression(unsigned int start, unsigned std::vector<expression *> subjects; std::vector<token_t> combiners; unsigned int idx = start; + bool first = true; while (idx < end) { - if (! subjects.empty()) + if (! first) { /* This is not the first expression, so we expect a combiner. */ token_t combiner = token_for_string(arg(idx))->tok; @@ -357,12 +358,18 @@ expression *test_parser::parse_combining_expression(unsigned int start, unsigned if (! expr) { add_error(L"Missing argument at index %u", idx); + if (! first) + { + /* Clean up the dangling combiner, since it never got its right hand expression */ + combiners.pop_back(); + } break; } /* Go to the end of this expression */ idx = expr->range.end; subjects.push_back(expr); + first = false; } if (! subjects.empty()) |