瀏覽代碼

prevent appending nil buffer

Darien Raymond 7 年之前
父節點
當前提交
fa6ff77cee
共有 1 個文件被更改,包括 3 次插入1 次删除
  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.