try
{
+
// Todo : will be re-implemented as using email_get_thread_information_ex
if(email_get_thread_information_ex(emailTreadId, &resultMail) != EMF_ERROR_NONE)
{
ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get email thread fail" );
}
+ if (!resultMail)
+ {
+ return NULL;
+ }
if (email_get_mail(&mailbox, resultMail->mail_id, &mail) != EMF_ERROR_NONE)
{
ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get email data fail" );
}
-
-
+
// account Id
m_unreadMessages = 0;
-
+
+ LogDebug("start email_get_mail_list_ex");
if (email_get_mail_list_ex(accountId, NULL, emailTreadId, 0, resultMail->thread_item_count,
EMF_SORT_DATETIME_HIGH, &mailList, &count) != EMF_ERROR_NONE)
{
ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get email data fail" );
}
-
+ LogDebug("end email_get_mail_list_ex");
+
// unread msg count
accountId = resultMail->account_id;
LogDebug(mail->head->previewBodyText);
m_preview = mail->head->previewBodyText;
}
-#endif
+#endif
// read
m_read = (bool)resultMail->flags_seen_field;
-
// from
if (resultMail->from[0] != '\0')
{
LogError("Exception: " << ex.GetMessage());
}
- if (resultMail != NULL)
+ if (mail != NULL)
{
- free(resultMail);
+ email_free_mail(&mail , 1);
}
- if (mail != NULL)
+ if (resultMail != NULL)
{
- email_free_mail(&mail , 1);
+ free(resultMail);
}
+
return m_result;
}