summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-20 10:05:39 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-20 10:05:39 -0700
commit41d11f1feb622494aeae9f7dd6a0115972b077e4 (patch)
tree7a4b9f3e4599686eea59797875939fcad590a373
parent244da920eedafec42da4e91b83c09d0021a36a7f (diff)
downloadbinaryen-41d11f1feb622494aeae9f7dd6a0115972b077e4.tar.gz
binaryen-41d11f1feb622494aeae9f7dd6a0115972b077e4.tar.bz2
binaryen-41d11f1feb622494aeae9f7dd6a0115972b077e4.zip
fix loop s-parsing
-rw-r--r--src/wasm-s-parser.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index b59af7215..7cada23af 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1046,13 +1046,13 @@ private:
Expression* makeLoop(Element& s) {
auto ret = allocator.alloc<Loop>();
size_t i = 1;
- if (s[i]->isStr() && s[i+1]->isStr()) { // out can only be named if both are
+ if (s.size() > i + 1 && s[i]->isStr() && s[i + 1]->isStr()) { // out can only be named if both are
ret->out = s[i]->str();
i++;
} else {
ret->out = getPrefixedName("loop-out");
}
- if (s[i]->isStr()) {
+ if (s.size() > i && s[i]->isStr()) {
ret->in = s[i]->str();
i++;
} else {