Update EscapeWriter HTML implementation to not output empty strings

This commit is contained in:
Ciprian Dorin Craciun 2020-05-24 20:45:37 +03:00 committed by Dirkjan Ochtman
parent b5a6a34bdd
commit b5ecf9bd87

View File

@ -129,7 +129,11 @@ impl Escaper for Html {
}
}
}
fmt.write_str(unsafe { str::from_utf8_unchecked(&bytes[start..]) })
if start < bytes.len() {
fmt.write_str(unsafe { str::from_utf8_unchecked(&bytes[start..]) })
} else {
Ok(())
}
}
}