Return undefined from Sound.generateSoundData if no sample data was yielded

This commit is contained in:
nucular 2014-05-25 23:26:23 +02:00
parent d7c314dc18
commit 39a001a1a4

View File

@ -442,6 +442,11 @@ end
function sfxr.Sound:generateSoundData(freq, bits)
freq = freq or sfxr.FREQ_44100
local tab = self:generateTable(freq, sfxr.BITS_FLOAT)
if #tab == 0 then
return nil
end
local data = love.sound.newSoundData(#tab, freq, bits, 1)
for i = 0, #tab - 1 do