mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 23:37:47 +00:00
p2pool: prevent deleting [0] node_vec and [panic!]
This commit is contained in:
parent
9faf0fc9f5
commit
4564070d92
1 changed files with 6 additions and 1 deletions
|
@ -302,7 +302,12 @@ impl P2pool {
|
|||
let mut n = 0;
|
||||
for (name, _) in node_vec.iter() {
|
||||
if *name == self.selected_name {
|
||||
self.selected_name = node_vec[n-1].0.clone();
|
||||
// If deleting [0], make selected = [1]
|
||||
// instead of attempting to [0-1] (panic!)
|
||||
match n {
|
||||
0 => self.selected_name = node_vec[1].0.clone(),
|
||||
_ => self.selected_name = node_vec[n-1].0.clone(),
|
||||
};
|
||||
node_vec.remove(n);
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue