diff options
Diffstat (limited to 'askama_escape')
-rw-r--r-- | askama_escape/src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs index 2771507..0222277 100644 --- a/askama_escape/src/lib.rs +++ b/askama_escape/src/lib.rs @@ -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(()) + } } } |