diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-11 17:41:26 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-11 17:41:26 +0000 |
commit | cf60bb00a9d1b2885975d05381d53f47bd92e3ba (patch) | |
tree | 6afa4d913b8acdae70f802b22dd6f44e519325e7 /pkg | |
parent | 3fb102cfc525d6d9582b892eb775d22c58cd5f10 (diff) | |
parent | 0cb9e1d021607723e008de877a056f2db2a32cef (diff) |
Merge release-20200422.0-64-g0cb9e1d (automated)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/tcpip/buffer/view.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/tcpip/buffer/view.go b/pkg/tcpip/buffer/view.go index f01217c91..9a3c5d6c3 100644 --- a/pkg/tcpip/buffer/view.go +++ b/pkg/tcpip/buffer/view.go @@ -59,6 +59,9 @@ func (v *View) Reader() bytes.Reader { // ToVectorisedView returns a VectorisedView containing the receiver. func (v View) ToVectorisedView() VectorisedView { + if len(v) == 0 { + return VectorisedView{} + } return NewVectorisedView(len(v), []View{v}) } @@ -229,6 +232,9 @@ func (vv *VectorisedView) Append(vv2 VectorisedView) { // AppendView appends the given view into this vectorised view. func (vv *VectorisedView) AppendView(v View) { + if len(v) == 0 { + return + } vv.views = append(vv.views, v) vv.size += len(v) } |