Handle branch is null bug

Hopefully I've now handled every single case of it.
This commit is contained in:
Vishesh Handa
2021-02-18 17:18:33 +01:00
parent a424df227c
commit 73c5c56a38
3 changed files with 16 additions and 4 deletions

View File

@ -93,7 +93,10 @@ class GitJournalRepo with ChangeNotifier {
if (remoteConfigured) {
// Code path for 'branch is null' exception
var branch = await repo.currentBranch();
if (branch == null) {
var head = await repo.head();
var branchConfig = repo.config.branch(branch);
if (branch == null || head == null || branchConfig == null) {
var remoteConfig = repo.config.remotes[0];
await cloneRemote(
repoPath: repoPath,