Fix an NPE in SubscriptionController.dump
Wink Saville [Thu, 16 Oct 2014 00:08:46 +0000 (17:08 -0700)]
Bug: 17945275
Change-Id: I076112ede5fd224284c23078b321fd282d0dffe0

src/java/com/android/internal/telephony/SubscriptionController.java

index 68bc62d..cc60a3e 100644 (file)
@@ -1388,14 +1388,26 @@ public class SubscriptionController extends ISub.Stub {
         pw.flush();
         pw.println("++++++++++++++++++++++++++++++++");
 
-        for (SubInfoRecord entry : getActiveSubInfoList()) {
-            pw.println(" ActiveSubInfoList:" + entry.toString());
+        List<SubInfoRecord> sirl = getActiveSubInfoList();
+        if (sirl != null) {
+            pw.println(" ActiveSubInfoList:");
+            for (SubInfoRecord entry : sirl) {
+                pw.println("  " + entry.toString());
+            }
+        } else {
+            pw.println(" ActiveSubInfoList: is null");
         }
         pw.flush();
         pw.println("++++++++++++++++++++++++++++++++");
 
-        for (SubInfoRecord entry : getAllSubInfoList()) {
-            pw.println(" AllSubInfoList:" + entry.toString());
+        sirl = getAllSubInfoList();
+        if (sirl != null) {
+            pw.println(" AllSubInfoList:");
+            for (SubInfoRecord entry : sirl) {
+                pw.println("  " + entry.toString());
+            }
+        } else {
+            pw.println(" AllSubInfoList: is null");
         }
         pw.flush();
         pw.println("++++++++++++++++++++++++++++++++");