Catch exceptions in SQLite3 callback

This commit is contained in:
Jude Melton-Houghton 2022-08-16 11:28:22 -04:00 committed by Loïc Blot
parent b89608c624
commit 006d974c58

@ -857,8 +857,12 @@ void ModMetadataDatabaseSQLite3::listMods(std::vector<std::string> *res)
char *errmsg; char *errmsg;
int status = sqlite3_exec(m_database, int status = sqlite3_exec(m_database,
"SELECT `modname` FROM `entries` GROUP BY `modname`;", "SELECT `modname` FROM `entries` GROUP BY `modname`;",
[](void *res_vp, int n_col, char **cols, char **col_names) -> int { [](void *res_vp, int n_col, char **cols, char **col_names) noexcept -> int {
((decltype(res)) res_vp)->emplace_back(cols[0]); try {
((decltype(res)) res_vp)->emplace_back(cols[0]);
} catch (...) {
return 1;
}
return 0; return 0;
}, (void *) res, &errmsg); }, (void *) res, &errmsg);
if (status != SQLITE_OK) { if (status != SQLITE_OK) {