summaryrefslogtreecommitdiff
path: root/apps/codecs/libm4a
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libm4a')
-rw-r--r--apps/codecs/libm4a/m4a.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/codecs/libm4a/m4a.c b/apps/codecs/libm4a/m4a.c
index f0666403ed..92e619db35 100644
--- a/apps/codecs/libm4a/m4a.c
+++ b/apps/codecs/libm4a/m4a.c
@@ -194,7 +194,8 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample)
prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples;
}
- if (sample >= demux_res->sample_to_chunk[0].num_samples)
+ if (prev_chunk_samples > 0 &&
+ sample >= demux_res->sample_to_chunk[0].num_samples)
{
chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples;
}