Skip to content

Commit

Permalink
fix: do not panic on missing patch url
Browse files Browse the repository at this point in the history
  • Loading branch information
louib committed Mar 21, 2024
1 parent e7d5506 commit 3aa1f5e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cyclone_dx.rs
Expand Up @@ -198,7 +198,17 @@ fn get_commits(patches: &Vec<crate::nix::Derivation>) -> Vec<Commit> {
let mut commits: Vec<Commit> = vec![];
for patch in patches {
let mut commit = CommitBuilder::default();
commit.url(patch.get_url().unwrap());
let commit_url = match patch.get_url() {
Some(u) => u,
None => {
log::warn!(
"No URL found for {}",
patch.get_name().unwrap_or("unknow derivation".to_string())
);
continue;
}
};
commit.url(commit_url);
// TODO we could also populate the uid, which is the commit SHA
commits.push(commit.build().unwrap())
}
Expand Down

0 comments on commit 3aa1f5e

Please sign in to comment.