Skip to content
This repository was archived by the owner on Dec 28, 2022. It is now read-only.

Commit e2a2f0e

Browse files
authored
if a range has no end still collapse the start (#117)
1 parent 42225f0 commit e2a2f0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/replicator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ module.exports = class Replicator {
11911191
for (let i = 0; i < this._ranges.length; i++) {
11921192
const r = this._ranges[i]
11931193

1194-
while (r.start < r.end && this.core.bitfield.get(mapIndex(r.blocks, r.start)) === true) r.start++
1194+
while ((r.end === -1 || r.start < r.end) && this.core.bitfield.get(mapIndex(r.blocks, r.start)) === true) r.start++
11951195
while (r.start < r.end && this.core.bitfield.get(mapIndex(r.blocks, r.end - 1)) === true) r.end--
11961196

11971197
if (r.end !== -1 && r.start >= r.end) {

0 commit comments

Comments
 (0)