Skip to content

Commit

Permalink
[built-package] fix panic caused by script in dependency (#14886)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgao1996 authored Oct 7, 2024
1 parent 87cbef7 commit ea47ce5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions aptos-move/framework/src/built_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,17 @@ impl BuiltPackage {
.package
.deps_compiled_units
.iter()
.map(|(name, unit)| {
let package_name = name.as_str().to_string();
let account = match &unit.unit {
CompiledUnit::Module(m) => AccountAddress::new(m.address.into_bytes()),
_ => panic!("script not a dependency"),
};
PackageDep {
account,
package_name,
}
.flat_map(|(name, unit)| match &unit.unit {
CompiledUnit::Module(m) => {
let package_name = name.as_str().to_string();
let account = AccountAddress::new(m.address.into_bytes());

Some(PackageDep {
account,
package_name,
})
},
CompiledUnit::Script(_) => None,
})
.collect::<BTreeSet<_>>()
.into_iter()
Expand Down

0 comments on commit ea47ce5

Please sign in to comment.