diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-09 13:15:01 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-09 13:15:01 +0200 |
commit | a0afd335c013a8af97ac20cffe48a2f9c8541812 (patch) | |
tree | ac4f746564cc297a06356004fb7684a9c43fb6a0 | |
parent | 4c4ef972ce362bd544aa3b4f6420849d22d48678 (diff) |
Assert instead of eternal loop.
-rw-r--r-- | searchlib/src/vespa/searchlib/docstore/randreaders.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp index aaefe333d55..83d12aee621 100644 --- a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp +++ b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp @@ -128,11 +128,13 @@ MMapRandReadDynamic::read(size_t offset, vespalib::DataBuffer & buffer, size_t s FSP file(_holder.get()); size_t end = offset + sz; const char * data(static_cast<const char *>(file->MemoryMapPtr(offset))); - while ((data == nullptr) || !contains(*file, end)) { + if ((data == nullptr) || !contains(*file, end)) { // Must check that both start and end of file is mapped in. remap(end); file = _holder.get(); data = static_cast<const char *>(file->MemoryMapPtr(offset)); + assert(data != nullptr); + assert(contains(*file, end)); } vespalib::DataBuffer(data, sz).swap(buffer); return file; |