Guard empty OpenAL listener slices
This commit is contained in:
committed by
Brandon McGinty
parent
c96617c71d
commit
208c986d56
@@ -40,6 +40,9 @@ func (self Listener) Set3f(param int32, value1, value2, value3 float32) {
|
||||
|
||||
// Renamed, was Listenerfv.
|
||||
func (self Listener) Setfv(param int32, values []float32) {
|
||||
if len(values) == 0 {
|
||||
return
|
||||
}
|
||||
C.walListenerfv(C.ALenum(param), unsafe.Pointer(&values[0]))
|
||||
}
|
||||
|
||||
@@ -55,6 +58,9 @@ func (self Listener) Set3i(param int32, value1, value2, value3 int32) {
|
||||
|
||||
// Renamed, was Listeneriv.
|
||||
func (self Listener) Setiv(param int32, values []int32) {
|
||||
if len(values) == 0 {
|
||||
return
|
||||
}
|
||||
C.walListeneriv(C.ALenum(param), unsafe.Pointer(&values[0]))
|
||||
}
|
||||
|
||||
@@ -72,6 +78,9 @@ func (self Listener) Get3f(param int32) (v1, v2, v3 float32) {
|
||||
|
||||
// Renamed, was GetListenerfv.
|
||||
func (self Listener) Getfv(param int32, values []float32) {
|
||||
if len(values) == 0 {
|
||||
return
|
||||
}
|
||||
C.walGetListenerfv(C.ALenum(param), unsafe.Pointer(&values[0]))
|
||||
return
|
||||
}
|
||||
@@ -90,6 +99,9 @@ func (self Listener) Get3i(param int32) (v1, v2, v3 int32) {
|
||||
|
||||
// Renamed, was GetListeneriv.
|
||||
func (self Listener) Getiv(param int32, values []int32) {
|
||||
if len(values) == 0 {
|
||||
return
|
||||
}
|
||||
C.walGetListeneriv(C.ALenum(param), unsafe.Pointer(&values[0]))
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ func TestEmptySliceAPIsDoNotPanic(t *testing.T) {
|
||||
source.Getiv(0, nil)
|
||||
source.QueueBuffers(nil)
|
||||
source.UnqueueBuffers(nil)
|
||||
var listener openal.Listener
|
||||
listener.Setfv(0, nil)
|
||||
listener.Setiv(0, nil)
|
||||
listener.Getfv(0, nil)
|
||||
listener.Getiv(0, nil)
|
||||
var buffer openal.Buffer
|
||||
buffer.SetData(openal.FormatMono8, nil, 0)
|
||||
buffer.SetDataInt16(openal.FormatMono16, nil, 0)
|
||||
|
||||
Reference in New Issue
Block a user