fix(rpc): do not crash when no input is consumed

fixes #23781

Co-authored-by: glacambre <code@lacamb.re>
This commit is contained in:
bfredl
2024-03-21 10:08:31 +01:00
parent 734848dc1a
commit 8921d56053
2 changed files with 22 additions and 1 deletions

View File

@@ -123,7 +123,10 @@ char *rbuffer_read_ptr(RBuffer *buf, size_t *read_count) FUNC_ATTR_NONNULL_ALL
void rbuffer_consumed(RBuffer *buf, size_t count)
FUNC_ATTR_NONNULL_ALL
{
assert(count && count <= buf->size);
if (count == 0) {
return;
}
assert(count <= buf->size);
buf->read_ptr += count;
if (buf->read_ptr >= buf->end_ptr) {