summaryrefslogtreecommitdiff
path: root/src/wasm-ast-parser-lexer-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-ast-parser-lexer-shared.c')
-rw-r--r--src/wasm-ast-parser-lexer-shared.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm-ast-parser-lexer-shared.c b/src/wasm-ast-parser-lexer-shared.c
index 865bff25..63eb44e7 100644
--- a/src/wasm-ast-parser-lexer-shared.c
+++ b/src/wasm-ast-parser-lexer-shared.c
@@ -51,7 +51,7 @@ void wasm_ast_format_error(WasmSourceErrorHandler* error_handler,
size_t source_line_length = 0;
int source_line_column_offset = 0;
size_t source_line_max_length = error_handler->source_line_max_length;
- if (loc) {
+ if (loc && lexer) {
source_line = alloca(source_line_max_length + 1);
WasmResult result = wasm_ast_lexer_get_source_line(
lexer, loc, source_line_max_length, source_line, &source_line_length,