OSDN Git Service

media: ignore null InputStream
authorRonghua Wu <ronghuawu@google.com>
Tue, 11 Aug 2015 20:33:49 +0000 (13:33 -0700)
committerRonghua Wu <ronghuawu@google.com>
Tue, 13 Oct 2015 15:29:42 +0000 (15:29 +0000)
Bug: 22854896
Change-Id: I20b9e28bbba6dec73538ee6937d337c2e2b971f4

media/java/android/media/MediaPlayer.java

index 13b2878..2e82e2f 100644 (file)
@@ -2243,10 +2243,14 @@ public class MediaPlayer implements SubtitleController.Listener
         final InputStream fIs = is;
         final MediaFormat fFormat = format;
 
-        // Ensure all input streams are closed.  It is also a handy
-        // way to implement timeouts in the future.
-        synchronized(mOpenSubtitleSources) {
-            mOpenSubtitleSources.add(is);
+        if (is != null) {
+            // Ensure all input streams are closed.  It is also a handy
+            // way to implement timeouts in the future.
+            synchronized(mOpenSubtitleSources) {
+                mOpenSubtitleSources.add(is);
+            }
+        } else {
+            Log.w(TAG, "addSubtitleSource called with null InputStream");
         }
 
         // process each subtitle in its own thread