summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index b4fcd3466..6280de7d3 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1517,8 +1517,7 @@ private:
ex->kind = Export::Table;
} else if (inner[0]->str() == GLOBAL) {
ex->kind = Export::Global;
- auto* global = wasm.getGlobal(ex->value);
- if (global->mutable_) throw ParseException("cannot export a mutable global", s.line, s.col);
+ if (wasm.checkGlobal(ex->value) && wasm.getGlobal(ex->value)->mutable_) throw ParseException("cannot export a mutable global", s.line, s.col);
} else {
WASM_UNREACHABLE();
}