Fix NPE when no pending intent was given
Setup wizard may not have sent a pending intent for activation
results, in which case we should not attempt to return them.
Bug: 10655576
Change-Id: I6cb89915d0319e75be984b2ce5808f8030e0c0a7
diff --git a/src/com/android/phone/HfaActivity.java b/src/com/android/phone/HfaActivity.java
index 3bc047d..c1753d0 100644
--- a/src/com/android/phone/HfaActivity.java
+++ b/src/com/android/phone/HfaActivity.java
@@ -225,14 +225,17 @@
final PendingIntent otaResponseIntent = getIntent().getParcelableExtra(
OtaUtils.EXTRA_OTASP_RESULT_CODE_PENDING_INTENT);
- final Intent extraStuff = new Intent();
- extraStuff.putExtra(OtaUtils.EXTRA_OTASP_RESULT_CODE, responseCode);
+ if (otaResponseIntent != null) {
+ final Intent extraStuff = new Intent();
+ extraStuff.putExtra(OtaUtils.EXTRA_OTASP_RESULT_CODE, responseCode);
- try {
- if (VERBOSE) Log.v(TAG, "Sending OTASP confirmation with result code: " + responseCode);
- otaResponseIntent.send(this, 0 /* resultCode (not used) */, extraStuff);
- } catch (CanceledException e) {
- Log.e(TAG, "Pending Intent canceled");
+ try {
+ if (VERBOSE) Log.v(TAG, "Sending OTASP confirmation with result code: "
+ + responseCode);
+ otaResponseIntent.send(this, 0 /* resultCode (not used) */, extraStuff);
+ } catch (CanceledException e) {
+ Log.e(TAG, "Pending Intent canceled");
+ }
}
finish();