From ea11871ddb4c6b64c019ba60ae3a0a86c1913a69 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 9 Feb 2018 16:49:15 +0100 Subject: [PATCH] Fix bug in linphone_core_get_call_history_size() when no database has been set. --- coreapi/call_log.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coreapi/call_log.c b/coreapi/call_log.c index cc1874e41..176ad4960 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -610,7 +610,10 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) { sqlite3_stmt *selectStatement; int returnValue; - if (!lc || lc->logs_db == NULL) return 0; + if (!lc) + return 0; + if (!lc->logs_db) + return (int)bctbx_list_size(lc->call_logs); buf = sqlite3_mprintf("SELECT count(*) FROM call_history"); returnValue = sqlite3_prepare_v2(lc->logs_db, buf, -1, &selectStatement, NULL);