[Android] widgets manager: Prevent NPE
Geoffrey Métais
git at videolan.org
Mon Aug 5 14:48:57 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 1 17:21:51 2019 +0200| [23465078b45695246dfb0c7adfc64998abc64fa4] | committer: Geoffrey Métais
widgets manager: Prevent NPE
> https://code.videolan.org/videolan/vlc-android/commit/23465078b45695246dfb0c7adfc64998abc64fa4
---
vlc-android/src/org/videolan/vlc/PlaybackService.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index e1ae26055..27c770517 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -484,7 +484,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
}
private fun updateHasWidget() {
- val manager = AppWidgetManager.getInstance(this)
+ val manager = AppWidgetManager.getInstance(this) ?: return
widget = when {
manager.getAppWidgetIds(ComponentName(this, VLCAppWidgetProviderWhite::class.java)).isNotEmpty() -> 1
manager.getAppWidgetIds(ComponentName(this, VLCAppWidgetProviderBlack::class.java)).isNotEmpty() -> 2
More information about the Android
mailing list