From 31fe15b6e07464cd3500bb32bc2c3ae384a5122a Mon Sep 17 00:00:00 2001 From: jinxiuxu Date: Thu, 7 Dec 2023 10:52:46 +0800 Subject: [PATCH] audio:fix crash when driver_audio capture sim/posix/sim_alsa.c:728:24: runtime error: member access within null pointer of type 'const struct sim_codec_ops_s' Signed-off-by: jinxiuxu --- arch/sim/src/sim/posix/sim_alsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sim/src/sim/posix/sim_alsa.c b/arch/sim/src/sim/posix/sim_alsa.c index 78b8ad6ab0..31dd67bb7f 100644 --- a/arch/sim/src/sim/posix/sim_alsa.c +++ b/arch/sim/src/sim/posix/sim_alsa.c @@ -723,7 +723,7 @@ static int sim_audio_ioctl(struct audio_lowerhalf_s *dev, int cmd, struct ap_buffer_info_s *info = (struct ap_buffer_info_s *)arg; - if (priv->ops->get_samples) + if (priv->ops && priv->ops->get_samples) { priv->buffer_size = MAX(priv->buffer_size, priv->ops->get_samples(priv->codec) *