mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-28 20:15:20 +03:00
fix: handle case when branch is not found in delete_branch function
This commit is contained in:
parent
0d667c1fa3
commit
f5331b4c1e
@ -1357,9 +1357,12 @@ pub fn delete_branch(
|
||||
let branch_reader = branch::Reader::new(¤t_session_reader);
|
||||
let branch_writer = branch::Writer::new(gb_repository);
|
||||
|
||||
let branch = branch_reader
|
||||
.read(branch_id)
|
||||
.context("failed to read branch")?;
|
||||
let branch = match branch_reader.read(branch_id) {
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => return Ok(()),
|
||||
Err(error) => Err(error),
|
||||
}
|
||||
.context("failed to read branch")?;
|
||||
|
||||
if branch.applied && unapply_branch(gb_repository, project_repository, branch_id)?.is_none() {
|
||||
return Ok(());
|
||||
|
Loading…
Reference in New Issue
Block a user