mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-11-21 13:31:36 +00:00
BugFix: asdf_buffer_get: check for valid handle
Was only testing for handle less than next_handle, but not checking for negative handle values. Fixed to use buffer_handle_valid() to test for a valid handle.
This commit is contained in:
parent
118065236b
commit
e13c9d6888
@ -193,7 +193,7 @@ void asdf_buffer_put(asdf_buffer_handle_t handle, asdf_keycode_t code)
|
|||||||
asdf_keycode_t asdf_buffer_get(asdf_buffer_handle_t handle)
|
asdf_keycode_t asdf_buffer_get(asdf_buffer_handle_t handle)
|
||||||
{
|
{
|
||||||
asdf_keycode_t code = ASDF_INVALID_CODE;
|
asdf_keycode_t code = ASDF_INVALID_CODE;
|
||||||
if (handle < next_handle && buffers[handle].count) {
|
if (buffer_handle_valid(handle) && buffers[handle].count) {
|
||||||
code = buffers[handle].buf[buffers[handle].tail];
|
code = buffers[handle].buf[buffers[handle].tail];
|
||||||
buffers[handle].tail = (buffers[handle].tail + 1) % buffers[handle].size;
|
buffers[handle].tail = (buffers[handle].tail + 1) % buffers[handle].size;
|
||||||
buffers[handle].count--;
|
buffers[handle].count--;
|
||||||
|
Loading…
Reference in New Issue
Block a user