Skip to content

Commit

Permalink
[server] guard against the null module being added as a dependency
Browse files Browse the repository at this point in the history
closes #11463
  • Loading branch information
Simn committed Jan 8, 2024
1 parent 05631cd commit 26807ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/compiler/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ let check_module sctx ctx m p =
in
let check_dependencies () =
PMap.iter (fun _ (sign,mpath) ->
let m2 = (com.cs#get_context sign)#find_module mpath in
let m2 = try
(com.cs#get_context sign)#find_module mpath
with Not_found ->
die (Printf.sprintf "Could not find dependency %s of %s in the cache" (s_type_path mpath) (s_type_path m.m_path)) __LOC__;
in
match check m2 with
| None -> ()
| Some reason -> raise (Dirty (DependencyDirty(m2.m_path,reason)))
Expand Down
2 changes: 1 addition & 1 deletion src/core/tFunctions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ let null_abstract = {
}

let add_dependency ?(skip_postprocess=false) m mdep =
if m != null_module && (m.m_path != mdep.m_path || m.m_extra.m_sign != mdep.m_extra.m_sign) then begin
if m != null_module && mdep != null_module && (m.m_path != mdep.m_path || m.m_extra.m_sign != mdep.m_extra.m_sign) then begin
m.m_extra.m_deps <- PMap.add mdep.m_id (mdep.m_extra.m_sign, mdep.m_path) m.m_extra.m_deps;
(* In case the module is cached, we'll have to run post-processing on it again (issue #10635) *)
if not skip_postprocess then m.m_extra.m_processed <- 0
Expand Down

0 comments on commit 26807ac

Please sign in to comment.