OSDN Git Service

Merge "Merge "Use the malloc debug heap dumper." am: 0ec0c17596 am: 84c9e9a787" into...
authorAndroid Build Merger (Role) <noreply-android-build-merger@google.com>
Sat, 16 Jun 2018 05:58:39 +0000 (05:58 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Sat, 16 Jun 2018 05:58:39 +0000 (05:58 +0000)
packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java
packages/SystemUI/src/com/android/systemui/util/Utils.java

index 2031b27..59b376f 100644 (file)
@@ -113,10 +113,6 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode
 
     @Override
     public void addCallback(Callback callback) {
-        if (callback == null) {
-            Slog.e(TAG, "Attempted to add a null callback.");
-            return;
-        }
         mCallbacks.add(callback);
     }
 
index eca6127..6812410 100644 (file)
@@ -26,11 +26,14 @@ public class Utils {
 
     /**
      * Allows lambda iteration over a list. It is done in reverse order so it is safe
-     * to add or remove items during the iteration.
+     * to add or remove items during the iteration.  Skips over null items.
      */
     public static <T> void safeForeach(List<T> list, Consumer<T> c) {
         for (int i = list.size() - 1; i >= 0; i--) {
-            c.accept(list.get(i));
+            T item = list.get(i);
+            if (item != null) {
+                c.accept(item);
+            }
         }
     }