diff options
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 3d57c5ada..9abdea744 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -1402,9 +1402,10 @@ private: } void parseData(Element& s) { + if (!hasMemory) throw ParseException("data but no memory"); Index i = 1; Expression* offset; - if (s[i]->isList()) { + if (i < s.size() && s[i]->isList()) { // there is an init expression offset = parseExpression(s[i++]); } else { |