From 240efd3157af809bb922ae8951c06964dd012706 Mon Sep 17 00:00:00 2001 From: "moon87.park" Date: Mon, 28 Dec 2015 14:28:51 +0900 Subject: [PATCH] [Telegram] Fixed crash issue in messaging view Change-Id: I582827e7b54728c37f92e8094ce29d6118f0cfad --- TelegramTizen/src/tg_messaging_view.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/TelegramTizen/src/tg_messaging_view.c b/TelegramTizen/src/tg_messaging_view.c index acfa719..d80aa9d 100644 --- a/TelegramTizen/src/tg_messaging_view.c +++ b/TelegramTizen/src/tg_messaging_view.c @@ -1529,7 +1529,7 @@ Evas_Object *on_message_item_content_get_cb(void *data, Evas_Object *obj, const elm_entry_item_provider_append(entry, item_provider, chat_scroller); tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id)); - if (media_msg->caption && strlen(media_msg) > 0) { + if (media_msg && media_msg->caption && strlen(media_msg->caption) > 0) { caption = strdup(media_msg->caption); } if (msg->out) { @@ -1564,11 +1564,12 @@ Evas_Object *on_message_item_content_get_cb(void *data, Evas_Object *obj, const } else if(msg->media_type == tgl_message_media_geo) { tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id)); - if (media_msg->caption && strlen(media_msg) > 0) { - caption = strdup(media_msg->caption); - } + char loc_url[4*256] = {0,}; if (media_msg) { + if (media_msg->caption && strlen(media_msg->caption) > 0) { + caption = strdup(media_msg->caption); + } snprintf(loc_url, sizeof(loc_url), "https://maps.google.com/?q=%s,%s", media_msg->latitude, media_msg->longitude); char temp_msg[4*256] = {0,}; snprintf(temp_msg, sizeof(temp_msg), "%s", loc_url); @@ -1585,11 +1586,11 @@ Evas_Object *on_message_item_content_get_cb(void *data, Evas_Object *obj, const } else if(msg->media_type == tgl_message_media_contact) { tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id)); - if (media_msg->caption && strlen(media_msg) > 0) { - caption = strdup(media_msg->caption); - } if (media_msg) { + if (media_msg->caption && strlen(media_msg->caption) > 0) { + caption = strdup(media_msg->caption); + } char temp_msg[4*256] = {0,}; snprintf(temp_msg, sizeof(temp_msg), "%s %s, %s", media_msg->first_name, media_msg->last_name, media_msg->phone_no); eina_strbuf_append(buf, temp_msg); @@ -1610,6 +1611,7 @@ Evas_Object *on_message_item_content_get_cb(void *data, Evas_Object *obj, const ad->loaded_msg_list = eina_list_append(ad->loaded_msg_list, entry); if (caption) { // implement UI. + LOGD("caption is (%s)", caption); free(caption); } -- 2.7.4