mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/readerdriver: Bug fix: createBuffer failed when the buffer size is 0
When the decoded audio size is exactly multiples of an internal buffer size, the buffer's size becomes exactly zero when being appended. In this case, createBuffer fails and the application crashes. This change fixes this issue by skipping to append a buffer in such cases. Closes #1635
This commit is contained in:
parent
1b5b861735
commit
97fa948e5e
@ -218,6 +218,10 @@ func (p *playerImpl) appendBuffer(this js.Value, args []js.Value) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
if len(bs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
l, r := toLR(bs)
|
||||
tl, tr := float32SliceToTypedArray(l), float32SliceToTypedArray(r)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user