mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
Merge pull request #280 from lorentey/minor-rope-updates
[Rope] remove(at:): Fix assertion when removing the last item creates a deficiency
This commit is contained in:
1 file changed
+4
-4
@@ -64,10 +64,10 @@ extension Rope._Node {
|
||||
let prepended = fixDeficiency(on: &path)
|
||||
isAtEnd = isAtEnd && prepended
|
||||
}
|
||||
if isAtEnd {
|
||||
if isAtEnd, path[h] < childCount - 1 {
|
||||
path[h] += 1
|
||||
path.clear(below: h)
|
||||
isAtEnd = path[h] == childCount
|
||||
isAtEnd = false
|
||||
}
|
||||
return (r.removed, r.delta, self.isUndersized, isAtEnd)
|
||||
}
|
||||
@@ -134,10 +134,10 @@ extension Rope._Node {
|
||||
let prepended = fixDeficiency(on: &path)
|
||||
isAtEnd = isAtEnd && prepended
|
||||
}
|
||||
if isAtEnd {
|
||||
if isAtEnd, path[h] < childCount - 1 {
|
||||
path[h] += 1
|
||||
path.clear(below: h)
|
||||
isAtEnd = path[h] == childCount
|
||||
isAtEnd = false
|
||||
}
|
||||
return (r.removed, r.delta, self.isUndersized, isAtEnd)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user