From 71e117965ee46dc9209dbe0d9aba77d303b050d0 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 12 Mar 2024 11:02:51 -0700 Subject: [PATCH] Fix issue with getSearchPath on nullptr on setOldestVersion --- ConflictSet.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 88ff72c..02b2202 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -2033,12 +2033,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { if (n == root) { n = nextLogical(n); } - for (; keyUpdates > 0; --keyUpdates) { - if (n == nullptr) { - removalKey = {}; - return; - } - + for (; keyUpdates > 0 && n != nullptr; --keyUpdates) { if (std::max(n->entry.pointVersion, n->entry.rangeVersion) <= oldestVersion) { // Any transaction n would have prevented from committing is @@ -2052,6 +2047,10 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { n = nextLogical(n); } } + if (n == nullptr) { + removalKey = {}; + return; + } removalKeyArena = Arena(); removalKey = getSearchPath(removalKeyArena, n); }