refactor(common): ensure empty StaticBufs don't make IoVecs

This commit is contained in:
Sean McArthur
2018-06-29 14:13:41 -07:00
parent 5a3efda0e7
commit b9ab8be986

View File

@@ -23,11 +23,11 @@ impl Buf for StaticBuf {
#[inline] #[inline]
fn bytes_vec<'t>(&'t self, dst: &mut [&'t IoVec]) -> usize { fn bytes_vec<'t>(&'t self, dst: &mut [&'t IoVec]) -> usize {
if dst.is_empty() { if dst.is_empty() || self.0.is_empty() {
return 0; 0
} else { } else {
dst[0] = self.0.into(); dst[0] = self.0.into();
return 1; 1
} }
} }
} }