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
1 changed files with 6 additions and 0 deletions

View File

@ -270,6 +270,12 @@ public:
a.head.prev->next = &a.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 {
swap(a.head, b.head);