mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-27 04:08:53 +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
aa9f669ec3
commit
410d0f52e5
@ -209,6 +209,10 @@ func (p *player) appendBuffer(this js.Value, args []js.Value) interface{} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(bs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
l, r := toLR(bs)
|
l, r := toLR(bs)
|
||||||
tl, tr := float32SliceToTypedArray(l), float32SliceToTypedArray(r)
|
tl, tr := float32SliceToTypedArray(l), float32SliceToTypedArray(r)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user