mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Avoid potential, but very unlikely NPE
This commit is contained in:
parent
4622b384f2
commit
394a0905dc
@ -36,13 +36,15 @@ public class SMSReceiver extends BroadcastReceiver {
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle != null) {
|
||||
Object[] pdus = (Object[]) bundle.get("pdus");
|
||||
for (Object pdu1 : pdus) {
|
||||
byte[] pdu = (byte[]) pdu1;
|
||||
SmsMessage message = SmsMessage.createFromPdu(pdu);
|
||||
notificationSpec.body = message.getDisplayMessageBody();
|
||||
notificationSpec.phoneNumber = message.getOriginatingAddress();
|
||||
if (notificationSpec.phoneNumber != null) {
|
||||
GBApplication.deviceService().onNotification(notificationSpec);
|
||||
if (pdus != null) {
|
||||
for (Object pdu1 : pdus) {
|
||||
byte[] pdu = (byte[]) pdu1;
|
||||
SmsMessage message = SmsMessage.createFromPdu(pdu);
|
||||
notificationSpec.body = message.getDisplayMessageBody();
|
||||
notificationSpec.phoneNumber = message.getOriginatingAddress();
|
||||
if (notificationSpec.phoneNumber != null) {
|
||||
GBApplication.deviceService().onNotification(notificationSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user