summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/memory/ref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/yt/memory/ref.cpp')
-rw-r--r--library/cpp/yt/memory/ref.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp
index 67032586eff..fc153bb02e3 100644
--- a/library/cpp/yt/memory/ref.cpp
+++ b/library/cpp/yt/memory/ref.cpp
@@ -278,11 +278,15 @@ std::vector<TSharedRef> TSharedRef::Split(size_t partSize) const
{
YT_VERIFY(partSize > 0);
std::vector<TSharedRef> result;
+ if (partSize >= Size()) {
+ result.push_back(Slice(Begin(), End()));
+ return result;
+ }
result.reserve(Size() / partSize + 1);
auto sliceBegin = Begin();
while (sliceBegin < End()) {
auto sliceEnd = sliceBegin + partSize;
- if (sliceEnd < sliceBegin || sliceEnd > End()) {
+ if (sliceEnd > End()) {
sliceEnd = End();
}
result.push_back(Slice(sliceBegin, sliceEnd));