Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -267,8 +267,10 @@ public static void visitBytes(Rope rope, BytesVisitor visitor, int offset, int l
final Rope child = repeating.getChild();

final int start = offset % child.byteLength();
final int firstPartLength = child.byteLength() - start;
final int firstPartLength = Math.min(child.byteLength() - start, length);

visitBytes(child, visitor, start, firstPartLength);

final int lengthMinusFirstPart = length - firstPartLength;
final int remainingEnd = lengthMinusFirstPart % child.byteLength();

@@ -283,7 +285,7 @@ public static void visitBytes(Rope rope, BytesVisitor visitor, int offset, int l
if (remainingEnd > 0) {
visitBytes(child, visitor, 0, remainingEnd);
}
} else {
} else if (remainingEnd > 0) {
visitBytes(child, visitor, 0, remainingEnd);
}
} else if (rope instanceof LazyRope) {

0 comments on commit 44d205c

Please sign in to comment.