mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
db: guard against no DB
Maybe if we only use `/connect` we dont have ProfAccount. In that case we won't log anything. Only if a account is used we log. If this is the case or the init of the db didn't work we still want profanity to run but wont log anything to the db.
This commit is contained in:
parent
11663625cc
commit
1155963c6c
@ -123,12 +123,20 @@ log_database_init(ProfAccount *account)
|
|||||||
void
|
void
|
||||||
log_database_close(void)
|
log_database_close(void)
|
||||||
{
|
{
|
||||||
sqlite3_close(g_chatlog_database);
|
if (g_chatlog_database) {
|
||||||
sqlite3_shutdown();
|
sqlite3_close(g_chatlog_database);
|
||||||
|
sqlite3_shutdown();
|
||||||
|
g_chatlog_database = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
log_database_add(ProfMessage *message, gboolean is_muc) {
|
log_database_add(ProfMessage *message, gboolean is_muc) {
|
||||||
|
if (!g_chatlog_database) {
|
||||||
|
log_debug("log_database_add() called but db is not initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char *err_msg;
|
char *err_msg;
|
||||||
char *query;
|
char *query;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user