diff options
-rw-r--r-- | src/database.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c index c04fea72..56e28135 100644 --- a/src/database.c +++ b/src/database.c @@ -214,6 +214,8 @@ log_database_get_previous_chat(const gchar* const contact_barejid) char* query; const char* jid = connection_get_fulljid(); Jid* myjid = jid_create(jid); + if (!myjid) + return NULL; if (asprintf(&query, "SELECT * FROM (SELECT `message`, `timestamp`, `from_jid`, `type` from `ChatLogs` WHERE (`from_jid` = '%s' AND `to_jid` = '%s') OR (`from_jid` = '%s' AND `to_jid` = '%s') ORDER BY `timestamp` DESC LIMIT 10) ORDER BY `timestamp` ASC;", contact_barejid, myjid->barejid, myjid->barejid, contact_barejid) == -1) { log_error("log_database_get_previous_chat(): SQL query. could not allocate memory"); |