mirror of https://github.com/mgba-emu/mgba.git
Util: Fix wrap condition on RingFIFORead if it's empty
This commit is contained in:
parent
041113b09c
commit
c3b411fb6b
|
@ -75,6 +75,10 @@ size_t RingFIFORead(struct RingFIFO* buffer, void* output, size_t length) {
|
|||
|
||||
// Wrap around if we can't fit enough in here
|
||||
if ((intptr_t) data - (intptr_t) buffer->data + length >= buffer->capacity) {
|
||||
if (end == data) {
|
||||
// Oops! If we wrap now, it'll appear full
|
||||
return 0;
|
||||
}
|
||||
data = buffer->data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue