diff --git a/source/audio.js b/source/audio.js index 1601615..6c149e2 100644 --- a/source/audio.js +++ b/source/audio.js @@ -36,9 +36,11 @@ function audio_init(callback) { }; function audio_play(buffer, loop) { - var source = audio_ctx.createBufferSource(); - source.buffer = buffer; - source.loop = loop; - source.connect(audio_ctx.destination); - source.start(); + if (buffer) { + var source = audio_ctx.createBufferSource(); + source.buffer = buffer; + source.loop = loop; + source.connect(audio_ctx.destination); + source.start(); + } }; \ No newline at end of file