Ignore prediction_hint request if hint string is NULL or empty 65/138365/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 12 Jul 2017 02:41:07 +0000 (11:41 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 12 Jul 2017 04:10:49 +0000 (04:10 +0000)
Need to consider the case when the application requests with
NULL or empty prediction hint string on purpose.
We might need to update candidate strings in those cases also.

Change-Id: I31ffc0b7d8b8704e8a068c5edce9e30959830468

src/ise.cpp

index ea1abc7..e2ad5b0 100644 (file)
@@ -2373,15 +2373,20 @@ static void ime_app_process_input_device_event_cb(ime_input_device_type_e device
 
 static void ime_app_prediction_hint_set_cb(const char *prediction_hint, void *user_data)
 {
-    LOGD("prediction hint : %s\n", prediction_hint);
     char *sender = "mms";
     char *caller_id = "mms";
     char *hint = (char *)prediction_hint;
-    input_smartreply_init(caller_id, sender, hint);
-    input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
 
-    if (input_smartreply_is_enabled())
-        input_smartreply_get_reply_async();
+    if (!prediction_hint) return;
+    LOGD("prediction hint : %s\n", prediction_hint);
+
+    if (strlen(prediction_hint) > 0) {
+        input_smartreply_init(caller_id, sender, hint);
+        input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
+
+        if (input_smartreply_is_enabled())
+            input_smartreply_get_reply_async();
+    }
 }
 
 static void ime_app_mime_type_set_cb(const char *mime_types, void *user_data)