figments: ringbuf: prevent infinite loop if ringbuf is empty

This commit is contained in:
Torrie Fischer 2023-12-11 07:48:59 +01:00
parent 3e5cead5ff
commit 1e2f60201d

View File

@ -86,6 +86,8 @@ struct Ringbuf {
size_t size() {
if (m_tail > m_head) {
return m_tail - m_head;
} else if (m_tail == m_head) {
return 0;
}
return m_tail + (Size - m_head);
}