fix incorrect case when removing an element from a circular buffer (#1584)

This commit is contained in:
Luo Xiu 2020-07-01 17:13:44 +08:00 committed by GitHub
parent 8a865bd15e
commit 8aae654645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -656,9 +656,8 @@ extension CircularBuffer: RangeReplaceableCollection {
case self.headBackingIndex:
self.advanceHeadIdx(by: 1)
self._buffer[bufferIndex] = nil
case self.indexBeforeHeadIdx():
case self.indexBeforeTailIdx():
self.advanceTailIdx(by: -1)
self.tailBackingIndex = self.indexBeforeTailIdx()
self._buffer[bufferIndex] = nil
default:
self._buffer[bufferIndex] = nil