Skip to content

Commit

Permalink
fix: crash when the program can't find the file to analyze
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 6607c273d2b4542688596bcd404beb32aa6d85ec8e02052a91e6135cc37c7665
  • Loading branch information
thindil committed Jan 10, 2025
1 parent b019f16 commit 53672b7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ proc main() {.raises: [], tags: [ReadIOEffect, WriteIOEffect, RootEffect],
# Try to convert the source code file to AST
let fileName: AbsoluteFile = toAbsolute(file = source,
base = toAbsoluteDir(path = getCurrentDir()))
if not fileExists(x = fileName):
abortProgram(message = "Can't find file '" & $fileName & "'.")
try:
openParser(p = codeParser, filename = fileName,
inputStream = llStreamOpen(filename = fileName,
Expand Down

0 comments on commit 53672b7

Please sign in to comment.