Fix a rare crash on startup (#19922)

Release Notes:

- Fixed a rare crash that could happen when certain SQL statements are
prepared
This commit is contained in:
Mikayla Maki
2024-10-29 12:30:55 -07:00
committed by GitHub
parent fc5cde9434
commit f3b7f5944d
+3 -3
View File
@@ -58,13 +58,13 @@ impl<'a> Statement<'a> {
&mut remaining_sql_ptr,
);
remaining_sql = CStr::from_ptr(remaining_sql_ptr);
statement.raw_statements.push(raw_statement);
connection.last_error().with_context(|| {
format!("Prepare call failed for query:\n{}", query.as_ref())
})?;
remaining_sql = CStr::from_ptr(remaining_sql_ptr);
statement.raw_statements.push(raw_statement);
if !connection.can_write() && sqlite3_stmt_readonly(raw_statement) == 0 {
let sql = CStr::from_ptr(sqlite3_sql(raw_statement));