mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01:00
fix node.remove(), update next node pointer
This commit is contained in:
parent
599e6b3385
commit
bfb2f2e9e1
@ -226,12 +226,15 @@ impl<T> Node<T> {
|
|||||||
fn remove(&mut self) {
|
fn remove(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.element = ptr::null_mut();
|
self.element = ptr::null_mut();
|
||||||
let next = self.next.take();
|
let mut next = self.next.take();
|
||||||
let mut prev = self.prev.take();
|
let mut prev = self.prev.take();
|
||||||
|
|
||||||
if let Some(ref mut prev) = prev {
|
if let Some(ref mut prev) = prev {
|
||||||
prev.as_mut().unwrap().next = next;
|
prev.as_mut().unwrap().next = next;
|
||||||
}
|
}
|
||||||
|
if let Some(ref mut next) = next {
|
||||||
|
next.as_mut().unwrap().prev = prev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user