Phone app crash after inserting SIM.
Bug: 36374338
Test: Manual
Change-Id: I7468339fdf2eaa53e9b380cab06ea909a98f89d3
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index b8c2fb3..d023b20 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -980,8 +980,10 @@
}
private void handleSetPreferredNetworkTypeResponse(Message msg) {
- if (getActivity().isDestroyed()) {
+ final Activity activity = getActivity();
+ if (activity == null || activity.isDestroyed()) {
// Access preferences of activity only if it is not destroyed
+ // or if fragment is not attached to an activity.
return;
}