Sfoglia il codice sorgente

prevent appending nil buffer

Darien Raymond 7 anni fa
parent
commit
fa6ff77cee
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      common/buf/multi_buffer.go

+ 3 - 1
common/buf/multi_buffer.go

@@ -57,7 +57,9 @@ func NewMultiBufferValue(b ...*Buffer) MultiBuffer {
 
 // Append appends buffer to the end of this MultiBuffer
 func (mb *MultiBuffer) Append(buf *Buffer) {
-	*mb = append(*mb, buf)
+	if buf != nil {
+		*mb = append(*mb, buf)
+	}
 }
 
 // AppendMulti appends a MultiBuffer to the end of this one.