From 2a1272ecfb8bc6c2ed9d856e1735abab31ade60d Mon Sep 17 00:00:00 2001 From: "Man, Jianting (Meco)" <920369182@qq.com> Date: Wed, 23 Mar 2022 02:28:24 -0400 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4c99=20(#5696)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/ipc/ringbuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/drivers/ipc/ringbuffer.c b/components/drivers/ipc/ringbuffer.c index deb8979930..7a0a98e37b 100644 --- a/components/drivers/ipc/ringbuffer.c +++ b/components/drivers/ipc/ringbuffer.c @@ -231,12 +231,14 @@ RTM_EXPORT(rt_ringbuffer_get); */ rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) { + rt_size_t size; + RT_ASSERT(rb != RT_NULL); *ptr = RT_NULL; /* whether has enough data */ - rt_size_t size = rt_ringbuffer_data_len(rb); + size = rt_ringbuffer_data_len(rb); /* no data */ if (size == 0)