[Android] Fix crash on playback error

Geoffrey Métais git at videolan.org
Fri Jan 26 17:58:07 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 26 17:57:49 2018 +0100| [74e7f6b2bda1bbde573699fdb79f2fa7b62712c8] | committer: Geoffrey Métais

Fix crash on playback error

> https://code.videolan.org/videolan/vlc-android/commit/74e7f6b2bda1bbde573699fdb79f2fa7b62712c8
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java     | 3 ---
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 ++++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index f806f2764..208b19d51 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -520,9 +520,6 @@ public class PlaybackService extends MediaBrowserServiceCompat{
                     executeUpdateProgress();
                     break;
                 case MediaPlayer.Event.EncounteredError:
-                    showToast(getString(
-                            R.string.invalid_location,
-                            playlistManager.getCurrentMedia().getLocation()), Toast.LENGTH_SHORT);
                     executeUpdate();
                     executeUpdateProgress();
                     break;
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 3d0009de2..69a72cf66 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -665,7 +665,12 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                     next()
                 }
             }
-            MediaPlayer.Event.EncounteredError -> next()
+            MediaPlayer.Event.EncounteredError -> {
+                service.showToast(service.getString(
+                            R.string.invalid_location,
+                            getCurrentMedia()?.getLocation() ?: ""), Toast.LENGTH_SHORT)
+                next()
+            }
         }
         service.onMediaPlayerEvent(event)
     }



More information about the Android mailing list