mirror of https://github.com/bobwen-dev/hunter
fix regression/crash when directory becomes empty
This commit is contained in:
parent
42b1fe7507
commit
b18e86f28e
|
@ -209,12 +209,13 @@ impl RefreshPackage {
|
|||
|
||||
// Need to unpack this to prevent issue with recursive Files type
|
||||
// Also, if no files remain add placeholder and set len
|
||||
let (files, new_len) = if files.len() > 0 {
|
||||
(files.files, files.len)
|
||||
let (files, new_len, new_buffer) = if files.len() > 0 {
|
||||
(files.files, files.len, new_buffer)
|
||||
} else {
|
||||
let placeholder = File::new_placeholder(&files.directory.path).unwrap();
|
||||
let buffer = vec![render_fn(&placeholder)];
|
||||
files.files.push(placeholder);
|
||||
(files.files, 1)
|
||||
(files.files, 1, buffer)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ impl Listable for ListView<Files> {
|
|||
let path = &self.content.directory.path;
|
||||
let placeholder = File::new_placeholder(&path)?;
|
||||
self.content.files.push(placeholder);
|
||||
self.content.len = 1;
|
||||
}
|
||||
|
||||
let sender = self.core.get_sender();
|
||||
|
|
Loading…
Reference in New Issue