From d1ac131294bf667968f959e850c5c2027aee52d2 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Thu, 27 Aug 2015 17:26:17 +0200 Subject: [PATCH] Fixed a bad access bug --- arangod/Utils/Transaction.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arangod/Utils/Transaction.h b/arangod/Utils/Transaction.h index 1b703d5260..91404f9228 100644 --- a/arangod/Utils/Transaction.h +++ b/arangod/Utils/Transaction.h @@ -428,8 +428,11 @@ namespace triagens { } TRI_ASSERT(batchSize > 0); TRI_doc_mptr_t const* ptr = nullptr; - do { + while (count < batchSize) { ptr = document->primaryIndex()->lookupSequential(internalSkip, total); + if (ptr == nullptr) { + break; + } if (skip > 0) { --skip; } @@ -440,7 +443,6 @@ namespace triagens { } } } - while (ptr != nullptr && count < batchSize); } catch (...) { this->unlock(trxCollection, TRI_TRANSACTION_READ);