Skip to content

Commit b455ae4

Browse files
maxwenGerrit Code Review
authored andcommitted
Fix for NPE in BluetoothSMSAccess
A broken sms info should never break phone app E/AndroidRuntime( 3367): FATAL EXCEPTION: HeadsetBase Event Thread E/AndroidRuntime( 3367): java.lang.NullPointerException E/AndroidRuntime( 3367): at com.android.phone.BluetoothSMSAccess.CreatePDUResponse(BluetoothSMSAccess.java:599) E/AndroidRuntime( 3367): at com.android.phone.BluetoothSMSAccess.access$1300(BluetoothSMSAccess.java:41) E/AndroidRuntime( 3367): at com.android.phone.BluetoothSMSAccess$7.handleSetCommand(BluetoothSMSAccess.java:354) E/AndroidRuntime( 3367): at android.bluetooth.AtParser.process(AtParser.java:350) E/AndroidRuntime( 3367): at android.bluetooth.HeadsetBase.handleInput(HeadsetBase.java:133) E/AndroidRuntime( 3367): at android.bluetooth.HeadsetBase$1.run(HeadsetBase.java:172) Change-Id: I796b224a9c052da6bb5caaed045bd743dcd4c783
1 parent 399da46 commit b455ae4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/com/android/phone/BluetoothSMSAccess.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ private AtCommandResult CreatePDUResponse(SMSMsgInfo smsInfo) {
596596
bo.write(4); // flags
597597

598598
byte[] destData = PhoneNumberUtils.networkPortionToCalledPartyBCD(smsInfo.OriginAddress);
599+
if( destData == null )
600+
return new AtCommandResult(AtCommandResult.ERROR);
601+
599602
int destLength = ((destData.length - 1) * 2
600603
- ((destData[destData.length - 1] & 0xf0) == 0xf0 ? 1 : 0));
601604

0 commit comments

Comments
 (0)