FS-11785 [libteletone] Fix unlikely divide by zero in teletone_mux_tones

This commit is contained in:
Chris Rienzo 2019-04-15 19:58:32 +00:00 committed by Mike Jerris
parent 96c8cb0473
commit 7187e8ecd2
1 changed files with 3 additions and 1 deletions

View File

@ -256,7 +256,9 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone
int32_t s = teletone_dds_state_modulate_sample(&tones[i], 0);
sample += s;
}
sample /= freqlen;
if (freqlen) {
sample /= freqlen;
}
ts->buffer[ts->samples] = (teletone_audio_t)sample;
for (c = 1; c < ts->channels; c++) {