Skip to content

Commit bae1782

Browse files
committed
Use Utf8Error for reword if invalid utf8
1 parent bd6e1a3 commit bae1782

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

asyncgit/src/sync/rebase.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ pub fn reword_safe(
1717
for b in repo.branches(None)? {
1818
let branch = b?.0;
1919
if branch.is_head() {
20-
cur_branch_ref = Some(String::from(
21-
branch
22-
.get()
23-
.name()
24-
.expect("Branch name is not valid utf8"),
25-
));
20+
cur_branch_ref = Some(String::from_utf8(
21+
branch.get().name_bytes().to_vec(),
22+
)?);
2623
break;
2724
}
2825
}

0 commit comments

Comments
 (0)