From b1cf31bca0b13e51a27f7cb3e431e847618308b9 Mon Sep 17 00:00:00 2001 From: Donghee Ye Date: Wed, 12 Sep 2012 10:52:50 +0900 Subject: Fix phonelog insert error with unknown number Change-Id: I40f6890449541f979af756ab6c4f9f4e7c7f84ea --- src/cts-phonelog.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cts-phonelog.c b/src/cts-phonelog.c index 5725410..42e0412 100755 --- a/src/cts-phonelog.c +++ b/src/cts-phonelog.c @@ -124,12 +124,14 @@ static inline int cts_insert_phonelog(cts_plog *plog) stmt = cts_query_prepare(query); retvm_if(NULL == stmt, CTS_ERR_DB_FAILED, "cts_query_prepare() Failed"); - cts_stmt_bind_text(stmt, 1, plog->number); - if (plog->log_type < CTS_PLOG_TYPE_EMAIL_RECEIVED) { - ret = cts_clean_number(plog->number, clean_num, sizeof(clean_num)); - if (0 < ret) { - normal_num = cts_normalize_number(clean_num); - cts_stmt_bind_text(stmt, 2, normal_num); + if (plog->number) { + cts_stmt_bind_text(stmt, 1, plog->number); + if (plog->log_type < CTS_PLOG_TYPE_EMAIL_RECEIVED) { + ret = cts_clean_number(plog->number, clean_num, sizeof(clean_num)); + if (0 < ret) { + normal_num = cts_normalize_number(clean_num); + cts_stmt_bind_text(stmt, 2, normal_num); + } } } -- cgit v1.2.3