Skip to content

Commit 542a941

Browse files
committed
fix: fix crash when eof
1 parent 8133b2a commit 542a941

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ASTree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
18301830
// sometimes JUMP ins after raise
18311831
// so we should check the end of current block
18321832
// current not in block end, skip 1 ins
1833-
if (prev->end() != pos) {
1833+
if (prev->end() != pos && !source.atEof()) {
18341834
bc_next(source, mod, opcode, operand, pos);
18351835
}
18361836
}
@@ -1854,7 +1854,7 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
18541854
blocks.pop();
18551855
curblock = blocks.top();
18561856
curblock->append(prev.cast<ASTNode>());
1857-
if (prev->end() != pos) {
1857+
if (prev->end() != pos && !source.atEof()) {
18581858
bc_next(source, mod, opcode, operand, pos);
18591859
}
18601860
}

0 commit comments

Comments
 (0)