[Android] Prevent NullPointerException in PlaylistManager
Nicolas Pomepuy
git at videolan.org
Tue Oct 26 06:45:23 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Oct 20 09:17:58 2021 +0200| [0ba900db4fabb7225f47d3f20ec8914665042240] | committer: Nicolas Pomepuy
Prevent NullPointerException in PlaylistManager
> https://code.videolan.org/videolan/vlc-android/commit/0ba900db4fabb7225f47d3f20ec8914665042240
---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 71bde085b..3352862de 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -22,6 +22,7 @@ import org.videolan.medialibrary.MLServiceLocator
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.resources.*
+import org.videolan.resources.util.VLCCrashHandler
import org.videolan.tools.*
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.PlaybackService
@@ -493,7 +494,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
medialibrary.setLastTime(media.id, time)
//todo this is not really optimised. The ML should return the new time value right away to let us save the processed new time.
// See https://code.videolan.org/videolan/medialibrary/-/issues/369
- media.time = medialibrary.getMedia(media.id).time
+ try {
+ media.time = medialibrary.getMedia(media.id).time
+ } catch (e: NullPointerException) {
+ VLCCrashHandler.saveLog(e, "NullPointerException in PlaylistManager saveMediaMeta")
+ }
}
}
media.setStringMeta(MediaWrapper.META_SPEED, rate.toString())
More information about the Android
mailing list