Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
fix(autodoc): avoid panic when module not found (ziglang#18699)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 authored Jan 30, 2024
1 parent e460ba6 commit 1b5cbf0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Autodoc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ const AutodocErrors = error{
OutOfMemory,
CurrentWorkingDirectoryUnlinked,
UnexpectedEndOfFile,
ModuleNotFound,
ImportOutsideModulePath,
} || std.fs.File.OpenError || std.fs.File.ReadError;

/// `call` instructions will have loopy references to themselves
Expand Down Expand Up @@ -1058,7 +1060,7 @@ fn walkInstruction(
);
}

const new_file = self.zcu.importFile(file, path) catch unreachable;
const new_file = try self.zcu.importFile(file, path);
const result = try self.files.getOrPut(self.arena, new_file.file);
if (result.found_existing) {
return DocData.WalkResult{
Expand Down

0 comments on commit 1b5cbf0

Please sign in to comment.