From f0847fc4eef266ac2bf42efee313a30014b1fff0 Mon Sep 17 00:00:00 2001 From: Divine <48183131+divine@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:13:47 +0000 Subject: [PATCH] fix: prevent crash when repository url is empty --- src/remote.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remote.rs b/src/remote.rs index 13c275ae2e..9e15b351dc 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -147,7 +147,7 @@ impl<'repo> Remote<'repo> { /// Get the remote's URL as a byte array. pub fn url_bytes(&self) -> &[u8] { - unsafe { crate::opt_bytes(self, raw::git_remote_url(&*self.raw)).unwrap() } + unsafe { crate::opt_bytes(self, raw::git_remote_url(&*self.raw)).unwrap_or(&[]) } } /// Get the remote's pushurl.