summaryrefslogtreecommitdiffstats
path: root/pkg/gui/filetree
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-05 14:24:28 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commit267da3b4db404140b45538a6e7082f833545a297 (patch)
tree87ed92f7456308c2b7810d77a1e05c185157fa92 /pkg/gui/filetree
parentc9ded489c94d7d12c6b5155089a0c97823aa5bc1 (diff)
fix issue when switching repos while files refresh
Diffstat (limited to 'pkg/gui/filetree')
-rw-r--r--pkg/gui/filetree/commit_file_node.go8
-rw-r--r--pkg/gui/filetree/file_node.go8
2 files changed, 14 insertions, 2 deletions
diff --git a/pkg/gui/filetree/commit_file_node.go b/pkg/gui/filetree/commit_file_node.go
index 91aba14c0..0edaf9c8e 100644
--- a/pkg/gui/filetree/commit_file_node.go
+++ b/pkg/gui/filetree/commit_file_node.go
@@ -111,7 +111,13 @@ func (node *CommitFileNode) GetNodeAtIndex(index int, collapsedPaths map[string]
return nil
}
- return getNodeAtIndex(node, index, collapsedPaths).(*CommitFileNode)
+ result := getNodeAtIndex(node, index, collapsedPaths)
+ if result == nil {
+ // not sure how this can be nil: we probably are missing a mutex somewhere
+ return nil
+ }
+
+ return result.(*CommitFileNode)
}
func (node *CommitFileNode) GetIndexForPath(path string, collapsedPaths map[string]bool) (int, bool) {
diff --git a/pkg/gui/filetree/file_node.go b/pkg/gui/filetree/file_node.go
index 649578fb0..802ff1ddf 100644
--- a/pkg/gui/filetree/file_node.go
+++ b/pkg/gui/filetree/file_node.go
@@ -97,7 +97,13 @@ func (node *FileNode) GetNodeAtIndex(index int, collapsedPaths map[string]bool)
return nil
}
- return getNodeAtIndex(node, index, collapsedPaths).(*FileNode)
+ result := getNodeAtIndex(node, index, collapsedPaths)
+ if result == nil {
+ // not sure how this can be nil: we probably are missing a mutex somewhere
+ return nil
+ }
+
+ return result.(*FileNode)
}
func (node *FileNode) GetIndexForPath(path string, collapsedPaths map[string]bool) (int, bool) {