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 <jinxiuxu@xiaomi.com>
This commit is contained in:
jinxiuxu 2023-12-07 10:52:46 +08:00 committed by Xiang Xiao
parent d7088fe376
commit 31fe15b6e0

View File

@ -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) *