1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Improve handling of NULL pointers in DB

Fix crash that occurs when message fetched from the database is NULL.

Introduced in this commit
89dc7a46f1

Previous fix attempt
6d17b4eeb5
This commit is contained in:
John Hernandez 2023-11-07 13:35:56 +01:00
parent 6d17b4eeb5
commit bc38ddf8fa

View File

@ -375,7 +375,7 @@ log_database_get_previous_chat(const gchar* const contact_barejid, const char* s
ProfMessage* msg = message_init(); ProfMessage* msg = message_init();
msg->from_jid = jid_create(from); msg->from_jid = jid_create(from);
msg->to_jid = jid_create(to_jid); msg->to_jid = jid_create(to_jid);
msg->plain = _db_strdup(message); msg->plain = strdup(message ?: "");
msg->timestamp = g_date_time_new_from_iso8601(date, NULL); msg->timestamp = g_date_time_new_from_iso8601(date, NULL);
msg->type = _get_message_type_type(type); msg->type = _get_message_type_type(type);
msg->enc = _get_message_enc_type(encryption); msg->enc = _get_message_enc_type(encryption);