Skip to content

Commit

Permalink
fix(build): do not unwrap modules unconditionally
Browse files Browse the repository at this point in the history
This happens for protos referencing a different package from their
name, i.e. something like foo/v1/bar.proto where bar.proto defines
`package foo.v1`.

Fixes tokio-rs#747
  • Loading branch information
matze committed Nov 9, 2022
1 parent 10c507c commit 55ee1c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions prost-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,9 @@ impl Config {

if let Some(ref mut service_generator) = self.service_generator {
for (module, package) in packages {
let buf = modules.get_mut(&module).unwrap();
service_generator.finalize_package(&package, buf);
if let Some(buf) = modules.get_mut(&module) {
service_generator.finalize_package(&package, buf);
}
}
}

Expand Down

0 comments on commit 55ee1c5

Please sign in to comment.