diff --git a/src/sorted_node_store.cpp b/src/sorted_node_store.cpp index 82dccb55..0e0c7a8a 100644 --- a/src/sorted_node_store.cpp +++ b/src/sorted_node_store.cpp @@ -423,9 +423,11 @@ void SortedNodeStore::publishGroup(const std::vector& nodes) { lastChunk = currentChunk; } - tmpLatpLons[currentNodeIndex] = nodes[i].second.latp; - tmpLatpLons[currentNodeIndex + 256] = nodes[i].second.lon; - currentNodeIndex++; + if (i != nodes.size()) { + tmpLatpLons[currentNodeIndex] = nodes[i].second.latp; + tmpLatpLons[currentNodeIndex + 256] = nodes[i].second.lon; + currentNodeIndex++; + } } uint64_t chunks = currentChunkIndex;