From ae5e279887b937a6cb51a1aa652bca9ecf2b84e2 Mon Sep 17 00:00:00 2001 From: Eugene Kurzberg Date: Mon, 25 Jul 2016 13:45:54 +0300 Subject: [PATCH] Fixed Logs crash caused by Unknown number. Change-Id: I7b2afad08c3b25510be7aba6305edae264b3aaea Signed-off-by: Eugene Kurzberg --- lib-logs/src/Logs/List/LogItem.cpp | 17 +++++++++++------ lib-logs/src/Logs/Model/LogProvider.cpp | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib-logs/src/Logs/List/LogItem.cpp b/lib-logs/src/Logs/List/LogItem.cpp index 6440a35..24ea9ed 100644 --- a/lib-logs/src/Logs/List/LogItem.cpp +++ b/lib-logs/src/Logs/List/LogItem.cpp @@ -86,17 +86,22 @@ char *LogItem::getText(Evas_Object *parent, const char *part) const char *name = log->getName(); const char *number = log->getNumber(); - if (name == nullptr) { - name = number; - number = _("IDS_LOGS_SBODY_UNSAVED_M_STATUS"); - } else if (strcmp(name, number) == 0){ + if (!name) { + if (number) { + name = number; + number = _("IDS_LOGS_SBODY_UNSAVED_M_STATUS"); + } else { + name = _("IDS_LOGS_MBODY_UNKNOWN"); + number = _("IDS_LOGS_SBODY_NO_NUMBER_ABB"); + } + } else if (Utils::safeCmp(name, number)){ number = _("IDS_LOGS_SBODY_SAVED_M_STATUS"); } if (strcmp(part, PART_LOG_NAME) == 0) { - return strdup(name); + return Utils::safeDup(name); } else if (strcmp(part, PART_LOG_NUMBER) == 0) { - return strdup(number); + return Utils::safeDup(number); } else if (strcmp(part, PART_LOG_COUNT) == 0) { if (m_Group->getLogList().size() == 1) { return nullptr; diff --git a/lib-logs/src/Logs/Model/LogProvider.cpp b/lib-logs/src/Logs/Model/LogProvider.cpp index 7e3f5ec..0be3be0 100644 --- a/lib-logs/src/Logs/Model/LogProvider.cpp +++ b/lib-logs/src/Logs/Model/LogProvider.cpp @@ -18,9 +18,9 @@ #include "Logs/Model/LogProvider.h" #include "Common/Database/RecordIterator.h" #include "Common/Database/RecordUtils.h" -#include "Utils/Logger.h" #include "Utils/Callback.h" #include "Utils/Range.h" +#include "Utils/String.h" #include @@ -121,7 +121,7 @@ bool LogProvider::shouldGroupLogs(Log &log, Log &prevLog) return (type == prevLog.getType() && type != CONTACTS_PLOG_TYPE_VOICE_INCOMING_UNSEEN && type != CONTACTS_PLOG_TYPE_VOICE_INCOMING_SEEN - && strcmp(log.getNumber(), prevLog.getNumber()) == 0 + && Utils::safeCmp(log.getNumber(), prevLog.getNumber()) && compareDate(log.getTime(), prevLog.getTime())); } -- 2.7.4