Fixes nil pointer deref in encoder.ProcessStream/Frame

This commit is contained in:
Markus Tzoe 2015-08-18 00:46:03 +08:00
parent d473c9b2fa
commit 351b7f600b

View file

@ -114,7 +114,7 @@ func (this *Encoder) ProcessStream(in []byte, cb Callback) {
// compress stage 2: adaptive hybrid filter
this.codec[i].filter.Encode(&curr)
this.fifo.put_value(&this.codec[i].rice, curr)
if i < this.channels {
if i < this.channels-1 {
i++
} else {
i = 0
@ -164,7 +164,7 @@ func (this *Encoder) ProcessFrame(in []byte) {
// compress stage 2: adaptive hybrid filter
this.codec[i].filter.Encode(&curr)
this.fifo.put_value(&this.codec[i].rice, curr)
if i < this.channels {
if i < this.channels-1 {
i++
} else {
i = 0