Prevent crash if icon is null

This commit is contained in:
Sylvain Berfini 2019-05-27 17:29:48 +02:00
parent cf0f88e71e
commit 11b223c0dc
3 changed files with 19 additions and 7 deletions

View file

@ -42,9 +42,17 @@ class ApiTwentyEightPlus {
Person me = new Person.Builder().setName(notif.getMyself()).build();
Notification.MessagingStyle style = new Notification.MessagingStyle(me);
for (NotifiableMessage message : notif.getMessages()) {
Icon userIcon = Icon.createWithBitmap(message.getSenderBitmap());
Person user =
new Person.Builder().setName(message.getSender()).setIcon(userIcon).build();
Icon userIcon = null;
if (message.getSenderBitmap() != null) {
userIcon = Icon.createWithBitmap(message.getSenderBitmap());
}
Person.Builder builder = new Person.Builder().setName(message.getSender());
if (userIcon != null) {
builder.setIcon(userIcon);
}
Person user = builder.build();
Notification.MessagingStyle.Message msg =
new Notification.MessagingStyle.Message(
message.getMessage(), message.getTime(), user);

View file

@ -2,7 +2,7 @@ package org.linphone.contacts;
/*
ContactsManager.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -370,7 +370,11 @@ public class ContactsManager extends ContentObserver implements FriendListListen
String normalized = lpc.normalizePhoneNumber(phoneNumber);
if (normalized == null) {
Log.w("[Contacts Manager] Couldn't normalize phone number " + phoneNumber + ", default proxy config prefix is " + lpc.getDialPrefix());
Log.w(
"[Contacts Manager] Couldn't normalize phone number "
+ phoneNumber
+ ", default proxy config prefix is "
+ lpc.getDialPrefix());
normalized = phoneNumber;
}
@ -386,7 +390,7 @@ public class ContactsManager extends ContentObserver implements FriendListListen
if (lf != null) {
return (LinphoneContact) lf.getUserData();
}
Log.w("[Contacts Manager] Couldn't find friend...");
return null;
}

View file

@ -106,7 +106,7 @@ public class ConfigureAccountActivity extends Activity {
}
// This will automatically create the proxy config and auth info and add them to the Core
ProxyConfig cfg = mAccountCreator.configure();
ProxyConfig cfg = mAccountCreator.createProxyConfig();
// Make sure the newly created one is the default
LinphoneService.getCore().setDefaultProxyConfig(cfg);
}