diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-03-21 10:08:31 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-03-21 15:52:28 +0100 |
commit | 8921d56053bb3702226c03f13232b45d5f2c27a4 (patch) | |
tree | 74187672eb0c6b8edbab1ef538b1a725ae74803b /src/nvim/rbuffer.c | |
parent | 734848dc1a9ebdf7af26cf54b92133cc6d94e19c (diff) | |
download | rneovim-8921d56053bb3702226c03f13232b45d5f2c27a4.tar.gz rneovim-8921d56053bb3702226c03f13232b45d5f2c27a4.tar.bz2 rneovim-8921d56053bb3702226c03f13232b45d5f2c27a4.zip |
fix(rpc): do not crash when no input is consumed
fixes #23781
Co-authored-by: glacambre <code@lacamb.re>
Diffstat (limited to 'src/nvim/rbuffer.c')
-rw-r--r-- | src/nvim/rbuffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c index ef286b3e22..493c079d4c 100644 --- a/src/nvim/rbuffer.c +++ b/src/nvim/rbuffer.c @@ -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) { |