Fix crash when reading from RingBuffer if it's full

This commit is contained in:
Wojtek Figat
2021-11-06 20:15:01 +01:00
parent e857ae4d24
commit 21e6e8bc7b

View File

@@ -69,13 +69,11 @@ public:
FORCE_INLINE T& PeekFront() FORCE_INLINE T& PeekFront()
{ {
ASSERT(_front != _back);
return _allocation.Get()[_front]; return _allocation.Get()[_front];
} }
FORCE_INLINE const T& PeekFront() const FORCE_INLINE const T& PeekFront() const
{ {
ASSERT(_front != _back);
return _allocation.Get()[_front]; return _allocation.Get()[_front];
} }
@@ -93,7 +91,6 @@ public:
void PopFront() void PopFront()
{ {
ASSERT(_front != _back);
Memory::DestructItems(_allocation.Get() + _front, 1); Memory::DestructItems(_allocation.Get() + _front, 1);
_front = (_front + 1) % _capacity; _front = (_front + 1) % _capacity;
_count--; _count--;