Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/tools/fuzzing/fuzzing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,9 @@ Expression* TranslateToFuzzReader::makeTry(Type type) {

Expression* TranslateToFuzzReader::makeTryTable(Type type) {
auto* body = make(type);

if (!funcContext) {
return makeTrivial(type);
}
if (funcContext->breakableStack.empty()) {
// Nothing to break to, emit a trivial TryTable.
// TODO: Perhaps generate a block wrapping us?
Expand Down Expand Up @@ -2535,7 +2537,7 @@ Expression* TranslateToFuzzReader::makeTryTable(Type type) {
}

Expression* TranslateToFuzzReader::makeBreak(Type type) {
if (funcContext->breakableStack.empty()) {
if (!funcContext || funcContext->breakableStack.empty()) {
return makeTrivial(type);
}
Expression* condition = nullptr;
Expand Down Expand Up @@ -4340,8 +4342,8 @@ Expression* TranslateToFuzzReader::makeSelect(Type type) {

Expression* TranslateToFuzzReader::makeSwitch(Type type) {
assert(type == Type::unreachable);
if (funcContext->breakableStack.empty()) {
return make(type);
if (!funcContext || funcContext->breakableStack.empty()) {
return makeTrivial(type);
}
// we need to find proper targets to break to; try a bunch
int tries = fuzzParams->TRIES;
Expand Down Expand Up @@ -4855,7 +4857,7 @@ Expression* TranslateToFuzzReader::makeRefCast(Type type) {
}

Expression* TranslateToFuzzReader::makeBrOn(Type type) {
if (funcContext->breakableStack.empty()) {
if (!funcContext || funcContext->breakableStack.empty()) {
return makeTrivial(type);
}
// We need to find a proper target to break to; try a few times. Finding the
Expand Down
Loading