aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-wasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api/sqlite3-wasm.c')
-rw-r--r--ext/wasm/api/sqlite3-wasm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c
index f2bf5fef1..5c9b53318 100644
--- a/ext/wasm/api/sqlite3-wasm.c
+++ b/ext/wasm/api/sqlite3-wasm.c
@@ -323,11 +323,13 @@ SQLITE_WASM_KEEP int sqlite3_wasm_pstack_quota(void){
*/
SQLITE_WASM_KEEP
int sqlite3_wasm_db_error(sqlite3*db, int err_code, const char *zMsg){
- if( 0!=zMsg ){
- const int nMsg = sqlite3Strlen30(zMsg);
- sqlite3ErrorWithMsg(db, err_code, "%.*s", nMsg, zMsg);
- }else{
- sqlite3ErrorWithMsg(db, err_code, NULL);
+ if( db!=0 ){
+ if( 0!=zMsg ){
+ const int nMsg = sqlite3Strlen30(zMsg);
+ sqlite3ErrorWithMsg(db, err_code, "%.*s", nMsg, zMsg);
+ }else{
+ sqlite3ErrorWithMsg(db, err_code, NULL);
+ }
}
return err_code;
}