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,6 +1125,7 @@ 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() {
if(sipContactCursor != null) {
for (int i = 0; i < sipContactCursor.getCount(); i++) { for (int i = 0; i < sipContactCursor.getCount(); i++) {
Contact contact = Compatibility.getContact(getContentResolver(), sipContactCursor, i); Contact contact = Compatibility.getContact(getContentResolver(), sipContactCursor, i);
if (contact == null) if (contact == null)
@ -1136,6 +1137,8 @@ public class LinphoneActivity extends FragmentActivity implements
} }
sipContactList.add(contact); sipContactList.add(contact);
} }
}
if(contactCursor != null) {
for (int i = 0; i < contactCursor.getCount(); i++) { for (int i = 0; i < contactCursor.getCount(); i++) {
Contact contact = Compatibility.getContact(getContentResolver(), contactCursor, i); Contact contact = Compatibility.getContact(getContentResolver(), contactCursor, i);
if (contact == null) if (contact == null)
@ -1150,6 +1153,7 @@ public class LinphoneActivity extends FragmentActivity implements
contactList.add(contact); contactList.add(contact);
} }
} }
}
}); });
contactList = new ArrayList<Contact>(); contactList = new ArrayList<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);
try {
GCMRegistrar.checkManifest(context); 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();