diff --git a/implementations/onblocks/datatreestore/DataTree.cpp b/implementations/onblocks/datatreestore/DataTree.cpp index 366d5f50..3326275a 100644 --- a/implementations/onblocks/datatreestore/DataTree.cpp +++ b/implementations/onblocks/datatreestore/DataTree.cpp @@ -160,6 +160,10 @@ uint32_t DataTree::_numLeaves(const DataNode &node) const { void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function func) { unique_lock lock(_mutex); //TODO Only lock when resizing. Otherwise parallel read/write to a blob is not possible! ASSERT(beginIndex <= endIndex, "Invalid parameters"); + if (0 == endIndex) { + // In this case the utils::ceilLog(_, endIndex) below would fail + return; + } uint8_t neededTreeDepth = utils::ceilLog(_nodeStore->layout().maxChildrenPerInnerNode(), endIndex); uint32_t numLeaves = this->_numLeaves(*_rootNode); // TODO Querying the size causes a tree traversal down to the leaves. Possible without querying the size?