Skip to content

Commit

Permalink
Fix a rare crash on startup (#19922)
Browse files Browse the repository at this point in the history
Release Notes:

- Fixed a rare crash that could happen when certain SQL statements are
prepared
  • Loading branch information
mikayla-maki authored Oct 29, 2024
1 parent fc5cde9 commit f3b7f59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/sqlez/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit f3b7f59

Please sign in to comment.