mirror of
https://github.com/xHyroM/zed-discord-presence.git
synced 2024-11-24 14:51:07 +01:00
fix: dont panic if git initialized without any remote
This commit is contained in:
parent
ab6fd3481d
commit
bc8fea3e78
1 changed files with 6 additions and 5 deletions
|
@ -32,11 +32,12 @@ fn get_main_remote_url(repository: Repository) -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return match repository.remotes() {
|
return match repository.remotes() {
|
||||||
Ok(remotes) => repository
|
Ok(remotes) => remotes.get(0).and_then(|name| {
|
||||||
.find_remote(remotes.get(0).unwrap())
|
repository
|
||||||
.unwrap()
|
.find_remote(name)
|
||||||
.url()
|
.ok()
|
||||||
.map(|url| transform_url(url.to_string())),
|
.and_then(|remote| remote.url().map(|url| transform_url(url.to_string())))
|
||||||
|
}),
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue