Fixed crash when changing tabs

This commit is contained in:
Abdelilah El Aissaoui 2024-09-09 00:31:54 +02:00
parent 1af4542c7c
commit 7b5290aef8
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -117,8 +117,6 @@ class TabViewModel @Inject constructor(
repository.workTree // test if repository is valid repository.workTree // test if repository is valid
_repositorySelectionStatus.value = RepositorySelectionStatus.Open(repository) _repositorySelectionStatus.value = RepositorySelectionStatus.Open(repository)
val git = Git(repository)
tabState.initGit(git)
val path = if (directory.name == ".git") { val path = if (directory.name == ".git") {
directory.parent directory.parent
@ -126,7 +124,10 @@ class TabViewModel @Inject constructor(
directory.absolutePath directory.absolutePath
onRepositoryChanged(path) onRepositoryChanged(path)
tabState.newSelectedItem(selectedItem = SelectedItem.UncommittedChanges)
val git = Git(repository)
tabState.initGit(git)
tabState.refreshData(RefreshType.ALL_DATA)
} catch (ex: Exception) { } catch (ex: Exception) {
onRepositoryChanged(null) onRepositoryChanged(null)
ex.printStackTrace() ex.printStackTrace()