diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-21 09:52:29 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-30 21:57:00 +1100 |
commit | fe4e305410b127c8bad8be0df04e3353da4ee278 (patch) | |
tree | 116b4fcef4617a7848e5705733e5d0c089bcca29 /pkg/commands/models | |
parent | 040c1fc3026e955977b6c73b0825c18805d261c3 (diff) |
safer code
Diffstat (limited to 'pkg/commands/models')
-rw-r--r-- | pkg/commands/models/status_line_node.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/commands/models/status_line_node.go b/pkg/commands/models/status_line_node.go index 84dc638ba..0bf3e8c3d 100644 --- a/pkg/commands/models/status_line_node.go +++ b/pkg/commands/models/status_line_node.go @@ -252,7 +252,7 @@ func (s *StatusLineNode) NameAtDepth(depth int) string { prevName := s.File.PreviousName // if the file has just been renamed inside the same directory, we can shave off // the prefix for the previous path too. Otherwise we'll keep it unchanged - sameParentDir := filepath.Join(splitName[0:depth]...) == filepath.Join(splitPrevName[0:depth]...) + sameParentDir := len(splitName) == len(splitPrevName) && filepath.Join(splitName[0:depth]...) == filepath.Join(splitPrevName[0:depth]...) if sameParentDir { prevName = filepath.Join(splitPrevName[depth:]...) } |