1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Only add an on-db-close cleanup entry for collations if adding the collation succeeds and xCompare is-a JS function.

FossilOrigin-Name: 18a5480f1e0dca55703b43fa17685a4cc577cab8841ce47c807af02348ad85ee
This commit is contained in:
stephan
2022-12-26 14:25:21 +00:00
parent 171aa209fa
commit 67e4f6fcdb
3 changed files with 10 additions and 8 deletions

View File

@ -935,7 +935,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
try{
const rc = __sqlite3CreateCollationV2(pDb, zName, eTextRep, pArg, xCompare, xDestroy);
if(xCompare) __dbCleanupMap.addCollation(pDb, zName);
if(0===rc && xCompare instanceof Function){
__dbCleanupMap.addCollation(pDb, zName);
}
return rc;
}catch(e){
return util.sqlite3_wasm_db_error(pDb, e);