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.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 96686cd4d..fe622f54a 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -185,15 +185,14 @@ void SExpressionParser::skipWhitespace() {
}
while (input[0] && input[0] != '\n') input++;
line++;
+ if (!input[0]) return;
lineStart = ++input;
} else if (input[0] == '(' && input[1] == ';') {
// Skip nested block comments.
input += 2;
int depth = 1;
while (1) {
- if (input[0] == 0) {
- return;
- }
+ if (!input[0]) return;
if (input[0] == '(' && input[1] == ';') {
input += 2;
depth++;
@@ -656,7 +655,7 @@ Function::DebugLocation SExpressionWasmBuilder::getDebugLocation(const SourceLoc
Expression* SExpressionWasmBuilder::parseExpression(Element& s) {
Expression* result = makeExpression(s);
- if (s.startLoc) {
+ if (s.startLoc && currFunction) {
currFunction->debugLocations[result] = getDebugLocation(*s.startLoc);
}
return result;