Fix phonelog insert error with unknown number 2.0alpha master 2.0_alpha submit/master/20120920.151105
authorDonghee Ye <donghee.ye@samsung.com>
Wed, 12 Sep 2012 01:52:50 +0000 (10:52 +0900)
committerDonghee Ye <donghee.ye@samsung.com>
Wed, 12 Sep 2012 01:52:50 +0000 (10:52 +0900)
Change-Id: I40f6890449541f979af756ab6c4f9f4e7c7f84ea

src/cts-phonelog.c

index 5725410..42e0412 100755 (executable)
@@ -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);
+                       }
                }
        }