[Android] Prevent UninitializedPropertyAccessException

Geoffrey Métais git at videolan.org
Mon Dec 17 11:11:11 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 17 10:05:28 2018 +0100| [fcff1a731efa17512ee9794560445a071b69c1f0] | committer: Geoffrey Métais

Prevent UninitializedPropertyAccessException

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

 vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
index c24788d5d..a333f2b3a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
@@ -186,7 +186,7 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
     override fun onStart() {
         super.onStart()
         if (restart) {
-            historyModel.refresh()
+            if (this::historyModel.isInitialized) historyModel.refresh()
             videoModel.refresh()
         } else restart = true
         if (selectedItem is MediaWrapper) TvUtil.updateBackground(backgroundManager, selectedItem)
@@ -280,7 +280,7 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
     }
 
     fun updateHistory() {
-        if (displayHistory) historyModel.refresh()
+        if (this::historyModel.isInitialized) historyModel.refresh()
     }
 
     override fun onChanged(list: MutableList<MediaWrapper>?) {



More information about the Android mailing list