From b297d4b7250ebb86d91a13ea535f0f32dc4388aa Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Mon, 20 May 2019 19:56:19 +0530 Subject: fixed: panics on empty local bare repos --- src/vcs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vcs.rs b/src/vcs.rs index 5bc194d..26edf81 100644 --- a/src/vcs.rs +++ b/src/vcs.rs @@ -21,7 +21,10 @@ pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)> return None } let repo = repo.unwrap(); - let reference = repo.head().unwrap(); + let reference = match repo.head() { + Ok(r) => r, + Err(_) => return None + }; let mut branch; if reference.is_branch() { -- cgit v1.2.3