util/IntrusiveList: fix swap() implementation if second list is empty

This commit is contained in:
Max Kellermann
2022-11-11 18:29:44 +01:00
parent 04ab8ae27b
commit df15c418c7

View File

@@ -270,6 +270,12 @@ public:
a.head.prev->next = &a.head; a.head.prev->next = &a.head;
b.head = {&b.head, &b.head}; b.head = {&b.head, &b.head};
} else if (b.empty()) {
b.head = a.head;
b.head.next->prev = &b.head;
b.head.prev->next = &b.head;
a.head = {&a.head, &a.head};
} else { } else {
swap(a.head, b.head); swap(a.head, b.head);