util/IntrusiveList: add missing initializer to insert_after()

We must not call std::next() if the list head was not yet initialized.
This was missing in commit 7065425927
This commit is contained in:
Max Kellermann 2023-09-11 21:14:39 +02:00
parent c391adad10
commit 44f55e1866
1 changed files with 4 additions and 0 deletions

View File

@ -538,6 +538,10 @@ public:
* Like insert(), but insert after the given position.
*/
void insert_after(iterator p, reference t) noexcept {
if constexpr (options.zero_initialized)
if (head.next == nullptr)
head = {&head, &head};
insert(std::next(p), t);
}