1
0
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:
cpfeiffer 2015-11-23 21:59:13 +01:00
parent 4622b384f2
commit 394a0905dc

View File

@ -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);
}
}
}
}