diff options
author | Sanket Padawe <sanketpadawe@google.com> | 2014-12-22 10:33:49 -0800 |
---|---|---|
committer | Sanket Padawe <sanketpadawe@google.com> | 2014-12-22 10:33:49 -0800 |
commit | 79d5da7bf6d0f64ef27a16c6c03a3b2dd622e92f (patch) | |
tree | b3bc449f8f0f4ebbe33fc305e6535a2089acef7d /src/com/android/settings/sim | |
parent | 19627ca215fa643a443722f183f3f781d4a2b041 (diff) | |
download | packages_apps_Settings-79d5da7bf6d0f64ef27a16c6c03a3b2dd622e92f.zip packages_apps_Settings-79d5da7bf6d0f64ef27a16c6c03a3b2dd622e92f.tar.gz packages_apps_Settings-79d5da7bf6d0f64ef27a16c6c03a3b2dd622e92f.tar.bz2 |
Fixed settings crash issue while recovering from phone crash.
Bug: 18816868
Change-Id: I2b3015f563aed2d997a3a5466ca8f0689fc53ddb
Diffstat (limited to 'src/com/android/settings/sim')
-rw-r--r-- | src/com/android/settings/sim/SimDialogActivity.java | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java index 019b5c0..0964f10 100644 --- a/src/com/android/settings/sim/SimDialogActivity.java +++ b/src/com/android/settings/sim/SimDialogActivity.java @@ -87,30 +87,37 @@ public class SimDialogActivity extends Activity { final Context context = getApplicationContext(); final SubscriptionInfo sir = Utils.findRecordBySlotId(context, slotId); - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); - alertDialogBuilder.setTitle(R.string.sim_preferred_title); - alertDialogBuilder.setMessage(res.getString( - R.string.sim_preferred_message, sir.getDisplayName())); - - alertDialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - final int subId = sir.getSubscriptionId(); - PhoneAccountHandle phoneAccountHandle = subscriptionIdToPhoneAccountHandle(subId); - setDefaultDataSubId(context, subId); - setDefaultSmsSubId(context, subId); - setUserSelectedOutgoingPhoneAccount(phoneAccountHandle); - finish(); - } - }); - alertDialogBuilder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog,int id) { - finish(); - } - }); + if (sir != null) { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); + alertDialogBuilder.setTitle(R.string.sim_preferred_title); + alertDialogBuilder.setMessage(res.getString( + R.string.sim_preferred_message, sir.getDisplayName())); + + alertDialogBuilder.setPositiveButton(R.string.yes, new + DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + final int subId = sir.getSubscriptionId(); + PhoneAccountHandle phoneAccountHandle = + subscriptionIdToPhoneAccountHandle(subId); + setDefaultDataSubId(context, subId); + setDefaultSmsSubId(context, subId); + setUserSelectedOutgoingPhoneAccount(phoneAccountHandle); + finish(); + } + }); + alertDialogBuilder.setNegativeButton(R.string.no, new + DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog,int id) { + finish(); + } + }); - alertDialogBuilder.create().show(); + alertDialogBuilder.create().show(); + } else { + finish(); + } } private static void setDefaultDataSubId(final Context context, final int subId) { |