Skip to content

Commit a3b90cb

Browse files
authored
Merge pull request #1120 from divine/patch-1
fix: prevent crash when repository url is empty
2 parents f095112 + f0847fc commit a3b90cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/remote.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'repo> Remote<'repo> {
147147

148148
/// Get the remote's URL as a byte array.
149149
pub fn url_bytes(&self) -> &[u8] {
150-
unsafe { crate::opt_bytes(self, raw::git_remote_url(&*self.raw)).unwrap() }
150+
unsafe { crate::opt_bytes(self, raw::git_remote_url(&*self.raw)).unwrap_or(&[]) }
151151
}
152152

153153
/// Get the remote's pushurl.

0 commit comments

Comments
 (0)