figments: ringbuf: prevent infinite loop if ringbuf is empty
This commit is contained in:
parent
3e5cead5ff
commit
1e2f60201d
@ -86,6 +86,8 @@ struct Ringbuf {
|
|||||||
size_t size() {
|
size_t size() {
|
||||||
if (m_tail > m_head) {
|
if (m_tail > m_head) {
|
||||||
return m_tail - m_head;
|
return m_tail - m_head;
|
||||||
|
} else if (m_tail == m_head) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return m_tail + (Size - m_head);
|
return m_tail + (Size - m_head);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user