From a285065102938b218928e226461ab61081917599 Mon Sep 17 00:00:00 2001 From: Guy Perfect Date: Sun, 20 Oct 2024 19:04:06 -0500 Subject: [PATCH] vbSetSamples fix --- core/vb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/vb.c b/core/vb.c index 242e66e..ef0790b 100644 --- a/core/vb.c +++ b/core/vb.c @@ -664,9 +664,9 @@ VBAPI vbOnRead vbSetReadCallback(VB *sim, vbOnRead callback) { /* Specify a new audio samples buffer */ VBAPI int vbSetSamples(VB *sim, void *samples, uint32_t capacity) { - if (capacity == 0 || capacity > 0x40000000) + if (samples != NULL && (capacity == 0 || capacity > 0x40000000)) return 1; - sim->vsu.out.capacity = capacity; + sim->vsu.out.capacity = samples == NULL ? 0 : capacity; sim->vsu.out.offset = 0; sim->vsu.out.samples = samples; return 0;