refactor(common): ensure empty StaticBufs don't make IoVecs
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user