Merge "Fixed NPE on MainContentCaptureSession.handleFlushIfNeeded"
diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java
index 83dbf2d..72aefb2 100644
--- a/core/java/android/view/contentcapture/MainContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java
@@ -402,7 +402,7 @@
     }
 
     private void handleFlushIfNeeded(@FlushReason int reason) {
-        if (mEvents.isEmpty()) {
+        if (mEvents == null || mEvents.isEmpty()) {
             if (VERBOSE) Log.v(TAG, "Nothing to flush");
             return;
         }