Permalink
Browse files

Fix potential NPE in UIViewOperationQueue.

Summary:
We were noticing the following crash in our application, that was occurring fairly often, but still hard to reproduce:

```
12-12 10:37:35.342: E/AndroidRuntime(9064): FATAL EXCEPTION: main
12-12 10:37:35.342: E/AndroidRuntime(9064): Process: com.bloomberg.android.plus, PID: 9064
12-12 10:37:35.342: E/AndroidRuntime(9064): java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.uimanager.UIViewOperationQueue$UIOperation.execute()' on a null object reference
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQ
Closes #11428

Differential Revision: D4487841

Pulled By: astreet

fbshipit-source-id: ae49ef77967edea7514cbf40cb533c4b63fd34ae
  • Loading branch information...
Mani Ghasemlou authored and facebook-github-bot committed Jan 31, 2017
1 parent 29616e3 commit cfb90284d654664c705a04fe451e7a16f0779b4f
@@ -25,6 +25,7 @@
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
import com.facebook.systrace.Systrace;
@@ -589,6 +590,7 @@ public void run() {
* subclass to support UIOperations not provided by UIViewOperationQueue.
*/
protected void enqueueUIOperation(UIOperation operation) {
SoftAssertions.assertNotNull(operation);
mOperations.add(operation);
}

0 comments on commit cfb9028

Please sign in to comment.