1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-03 15:39:50 +00:00

fix node.remove(), update next node pointer

This commit is contained in:
Nikolay Kim 2018-09-17 10:25:45 -07:00
parent 599e6b3385
commit bfb2f2e9e1

View file

@ -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;
}
} }
} }
} }