mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
db: fix inserting null in database
This commit is contained in:
parent
dc0b7b5e91
commit
c56443fea5
@ -153,7 +153,7 @@ log_database_add(ProfMessage *message, gboolean is_muc) {
|
||||
//gchar *date_fmt = g_date_time_format_iso8601(message->timestamp);
|
||||
gchar *date_fmt = g_date_time_format(message->timestamp, "%Y/%m/%d %H:%M:%S");
|
||||
if (asprintf(&query, "INSERT INTO `ChatLogs` (`jid`, `resource`, `message`, `timestamp`, `is_muc`, `stanza_id`, `replace_id`) VALUES ('%s', '%s', '%s', '%s', '%d', '%s', '%s')",
|
||||
message->jid->barejid, message->jid->resourcepart, message->plain, date_fmt, is_muc, message->id, message->replace_id) == -1) {
|
||||
message->jid->barejid, message->jid->resourcepart, message->plain, date_fmt, is_muc, message->id ? message->id : "", message->replace_id ? message->replace_id : "") == -1) {
|
||||
log_error("log_database_add(): could not allocate memory");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user