mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Fixed underflow
This commit is contained in:
@@ -592,7 +592,10 @@ impl FileTransferActivity {
|
|||||||
// Set index; keep if possible, otherwise set to last item
|
// Set index; keep if possible, otherwise set to last item
|
||||||
self.local.index = match self.local.files.get(self.local.index) {
|
self.local.index = match self.local.files.get(self.local.index) {
|
||||||
Some(_) => self.local.index,
|
Some(_) => self.local.index,
|
||||||
None => self.local.files.len() - 1,
|
None => match self.local.files.len() {
|
||||||
|
0 => 0,
|
||||||
|
_ => self.local.files.len() - 1,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// Sort files
|
// Sort files
|
||||||
self.local.sort_files_by_name();
|
self.local.sort_files_by_name();
|
||||||
@@ -620,7 +623,10 @@ impl FileTransferActivity {
|
|||||||
// Set index; keep if possible, otherwise set to last item
|
// Set index; keep if possible, otherwise set to last item
|
||||||
self.remote.index = match self.remote.files.get(self.remote.index) {
|
self.remote.index = match self.remote.files.get(self.remote.index) {
|
||||||
Some(_) => self.remote.index,
|
Some(_) => self.remote.index,
|
||||||
None => self.remote.files.len() - 1,
|
None => match self.remote.files.len() {
|
||||||
|
0 => 0,
|
||||||
|
_ => self.remote.files.len() - 1,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// Sort files
|
// Sort files
|
||||||
self.remote.sort_files_by_name();
|
self.remote.sort_files_by_name();
|
||||||
|
|||||||
Reference in New Issue
Block a user