Skip to content

Commit

Permalink
[bug] [ir] Fix Block::replace_with segment faults when stmts.size() =…
Browse files Browse the repository at this point in the history
…= 0 (#1072)
  • Loading branch information
archibate authored May 31, 2020
1 parent e8c1ff8 commit e73d647
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion taichi/ir/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ void Block::replace_with(Stmt *old_statement,
}
}
TI_ASSERT(location != -1);
if (replace_usages)
if (replace_usages && !new_statements.stmts.empty())
old_statement->replace_with(new_statements.back().get());
trash_bin.push_back(std::move(statements[location]));
if (new_statements.size() == 1) {
Expand Down

0 comments on commit e73d647

Please sign in to comment.