Fix panic on making tree

This commit is contained in:
Kovid Goyal
2023-07-25 18:54:00 +05:30
parent a55a918d4f
commit fd691b7835

View File

@@ -577,7 +577,11 @@ func (self *tree_node) add_child(f *remote_file) *tree_node {
return self
}
c := tree_node{entry: f, parent: self, added_files: make(map[*remote_file]*tree_node)}
f.expanded_local_path = filepath.Join(self.entry.expanded_local_path, filepath.Base(f.remote_path))
if self.entry != nil {
f.expanded_local_path = filepath.Join(self.entry.expanded_local_path, filepath.Base(f.remote_path))
} else {
f.expanded_local_path = f.remote_path
}
self.added_files[f] = &c
return &c
}