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]
fn bytes_vec<'t>(&'t self, dst: &mut [&'t IoVec]) -> usize {
if dst.is_empty() {
return 0;
if dst.is_empty() || self.0.is_empty() {
0
} else {
dst[0] = self.0.into();
return 1;
1
}
}
}