don't break when write length is zero

Signed-off-by: Fuang.Cao <cavan.cfa@gmail.com>