Index: base/android/java/src/org/chromium/base/ObserverList.java |
diff --git a/base/android/java/src/org/chromium/base/ObserverList.java b/base/android/java/src/org/chromium/base/ObserverList.java |
index 87e5e644e11bf8f8e82d93051b18ef92191810b1..012f4755a00e8b12ea3f1443b0506a3d3100c70f 100644 |
--- a/base/android/java/src/org/chromium/base/ObserverList.java |
+++ b/base/android/java/src/org/chromium/base/ObserverList.java |
@@ -73,10 +73,14 @@ public class ObserverList<E> implements Iterable<E> { |
* @return true if an element was removed as a result of this call. |
*/ |
public boolean removeObserver(E obs) { |
- int index = mObservers.indexOf(obs); |
+ if (obs == null) { |
+ return false; |
+ } |
- if (index == -1) |
+ int index = mObservers.indexOf(obs); |
+ if (index == -1) { |
return false; |
+ } |
if (mIterationDepth == 0) { |
// No one is iterating over the list. |