Avoid relying on sqlite to justify str::from_utf8_unchecked

This commit is contained in:
Thom Chiovoloni
2020-04-14 09:07:01 -07:00
committed by Thom Chiovoloni
parent 1b27ce0541
commit cf9b6e9ae2
4 changed files with 19 additions and 14 deletions

View File

@@ -672,7 +672,7 @@ impl Statement<'_> {
unsafe {
match self.stmt.expanded_sql() {
Some(s) => {
let sql = str::from_utf8_unchecked(s.to_bytes()).to_owned();
let sql = String::from_utf8_lossy(s.to_bytes()).to_string();
ffi::sqlite3_free(s.as_ptr() as *mut _);
Some(sql)
}