Эх сурвалжийг харах

Merge pull request #2980 from nextcloud/preventNPEonMediaStream

Prevent NPE on media stream
Andy Scherzinger 6 жил өмнө
parent
commit
26c56114ee

+ 2 - 2
src/main/java/com/owncloud/android/media/MediaService.java

@@ -700,7 +700,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
     }
 
 
-    protected void setMediaContoller(MediaControlView mediaController) {
+    protected void setMediaController(MediaControlView mediaController) {
         mMediaController = mediaController;
     }
 
@@ -734,7 +734,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         protected void onPostExecute(String url) {
             MediaService mediaService = mediaServiceWeakReference.get();
 
-            if (mediaService != null) {
+            if (mediaService != null && mediaService.getCurrentFile() != null) {
                 if (url != null) {
                     try {
                         mediaService.mPlayer.setDataSource(url);

+ 2 - 2
src/main/java/com/owncloud/android/media/MediaServiceBinder.java

@@ -157,12 +157,12 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
 
 
     public void registerMediaController(MediaControlView mediaController) {
-        mService.setMediaContoller(mediaController);
+        mService.setMediaController(mediaController);
     }
 
     public void unregisterMediaController(MediaControlView mediaController) {
         if (mediaController != null && mediaController == mService.getMediaController()) {
-            mService.setMediaContoller(null);
+            mService.setMediaController(null);
         }
 
     }