summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 0263b2112..2290a4972 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -48,7 +48,7 @@ Element::List& Element::list() {
}
Element* Element::operator[](unsigned i) {
- if (i >= list().size()) element_assert(0 && "expected more elements in list");
+ if (i >= list().size()) throw ParseException("expected more elements in list", line, col);
return list()[i];
}
@@ -114,8 +114,10 @@ Element* SExpressionParser::parse() {
} else if (input[0] == ')') {
input++;
auto last = curr;
+ if (stack.empty()) {
+ throw ParseException("s-expr stack empty");
+ }
curr = stack.back();
- assert(stack.size());
stack.pop_back();
curr->list().push_back(last);
} else {