From d7e66be51a2a980c9b0f46308d3323b91da9f0ef Mon Sep 17 00:00:00 2001 From: cppdev123 <66138068+cppdev123@users.noreply.github.com> Date: Wed, 21 Sep 2022 18:25:31 +0200 Subject: [PATCH] don't use `sqlite3_result_null ` if the optional has a value --- hdr/sqlite_modern_cpp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hdr/sqlite_modern_cpp.h b/hdr/sqlite_modern_cpp.h index 344dedcb..d990b511 100644 --- a/hdr/sqlite_modern_cpp.h +++ b/hdr/sqlite_modern_cpp.h @@ -814,8 +814,9 @@ namespace sqlite { template inline void store_result_in_db(sqlite3_context* db, const optional& val) { if(val) { store_result_in_db(db, *val); + } else { + sqlite3_result_null(db); } - sqlite3_result_null(db); } template inline void get_col_from_db(database_binder& db, int inx, optional& o) { @@ -858,8 +859,9 @@ namespace sqlite { template inline void store_result_in_db(sqlite3_context* db, const boost::optional& val) { if(val) { store_result_in_db(db, *val); + } else { + sqlite3_result_null(db); } - sqlite3_result_null(db); } template inline void get_col_from_db(database_binder& db, int inx, boost::optional& o) {