librb: rb_rawbuf_length: do something if soft assert fails

correct the value of rb->len
This commit is contained in:
Simon Arlott 2017-07-29 17:47:07 +01:00
parent 108699df3c
commit 2100c58d09
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24

View file

@ -269,8 +269,8 @@ rb_rawbuf_get(rawbuf_head_t * rb, void *data, int len)
int
rb_rawbuf_length(rawbuf_head_t * rb)
{
if(rb_dlink_list_length(&rb->list) == 0 && rb->len != 0)
lrb_assert(1 == 0);
if (rb_dlink_list_length(&rb->list) == 0 && lrb_assert(rb->len == 0))
rb->len = 0;
return rb->len;
}