Fix crash

This commit is contained in:
Margaux Clerc 2014-09-10 10:32:28 +02:00
parent 20a45a72ae
commit 94cd40f141
2 changed files with 30 additions and 22 deletions

View file

@ -1125,29 +1125,33 @@ public class LinphoneActivity extends FragmentActivity implements
Thread sipContactsHandler = new Thread(new Runnable() { Thread sipContactsHandler = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
for (int i = 0; i < sipContactCursor.getCount(); i++) { if(sipContactCursor != null) {
Contact contact = Compatibility.getContact(getContentResolver(), sipContactCursor, i); for (int i = 0; i < sipContactCursor.getCount(); i++) {
if (contact == null) Contact contact = Compatibility.getContact(getContentResolver(), sipContactCursor, i);
continue; if (contact == null)
continue;
contact.refresh(getContentResolver()); contact.refresh(getContentResolver());
if (!isContactPresenceDisabled) { if (!isContactPresenceDisabled) {
searchFriendAndAddToContact(contact); searchFriendAndAddToContact(contact);
}
sipContactList.add(contact);
}
for (int i = 0; i < contactCursor.getCount(); i++) {
Contact contact = Compatibility.getContact(getContentResolver(), contactCursor, i);
if (contact == null)
continue;
for (Contact c : sipContactList) {
if (c != null && c.getID().equals(contact.getID())) {
contact = c;
break;
} }
sipContactList.add(contact);
}
}
if(contactCursor != null) {
for (int i = 0; i < contactCursor.getCount(); i++) {
Contact contact = Compatibility.getContact(getContentResolver(), contactCursor, i);
if (contact == null)
continue;
for (Contact c : sipContactList) {
if (c != null && c.getID().equals(contact.getID())) {
contact = c;
break;
}
}
contactList.add(contact);
} }
contactList.add(contact);
} }
} }
}); });

View file

@ -38,7 +38,11 @@ public class ApiEightPlus {
try { try {
// Starting the push notification service // Starting the push notification service
GCMRegistrar.checkDevice(context); GCMRegistrar.checkDevice(context);
GCMRegistrar.checkManifest(context); try {
GCMRegistrar.checkManifest(context);
} catch (IllegalStateException e){
Log.e("No receiver found",e);
}
final String regId = GCMRegistrar.getRegistrationId(context); final String regId = GCMRegistrar.getRegistrationId(context);
String newPushSenderID = context.getString(R.string.push_sender_id); String newPushSenderID = context.getString(R.string.push_sender_id);
String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID(); String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID();