Commit 6f94e788 authored by DanmeiChen's avatar DanmeiChen
Browse files

fix crash with magic research

parent 6fe06b08
......@@ -173,6 +173,12 @@ list<SearchResult> MagicSearch::getContactListFromFilter (const string &filter,
return returnList;
}
static int compareStringItems(const char *a, const char *b) {
if (a == nullptr) a = "";
if (b == nullptr) b = "";
return strcmp(a, b);
}
/////////////////////
// Private Methods //
/////////////////////
......@@ -298,7 +304,7 @@ list<SearchResult> *MagicSearch::beginNewSearch (const string &filter, const str
// Check in order: Friend's display name, address username, address domain, phone number
if (name1 == name2) {
if (lsr.getAddress() && rsr.getAddress()) {
int usernameComp = strcmp(linphone_address_get_username(lsr.getAddress()), linphone_address_get_username(rsr.getAddress()));
int usernameComp = compareStringItems(linphone_address_get_username(lsr.getAddress()), linphone_address_get_username(rsr.getAddress()));
if (usernameComp == 0) {
int domainComp = strcmp(linphone_address_get_domain(lsr.getAddress()), linphone_address_get_domain(rsr.getAddress()));
if (domainComp == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment