[Android] VideoListAdapter: Avoid NPE
Geoffrey Métais
git at videolan.org
Wed Feb 14 14:39:00 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 14 14:38:17 2018 +0100| [879998f0e6734276a14b3f7fa5abfb8a0b04f66e] | committer: Geoffrey Métais
VideoListAdapter: Avoid NPE
> https://code.videolan.org/videolan/vlc-android/commit/879998f0e6734276a14b3f7fa5abfb8a0b04f66e
---
vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index d7fb579d7..60a89c84b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -21,10 +21,10 @@
package org.videolan.vlc.gui.video;
import android.content.Context;
+import android.content.SharedPreferences;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
-import android.preference.PreferenceManager;
import android.support.annotation.MainThread;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
@@ -77,7 +77,8 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
VideoListAdapter(IEventsHandler eventsHandler) {
super();
mEventsHandler = eventsHandler;
- mIsSeenMediaMarkerVisible = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("media_seen", true);
+ final SharedPreferences settings = VLCApplication.getSettings();
+ mIsSeenMediaMarkerVisible = settings == null || settings.getBoolean("media_seen", true);
}
@Override
More information about the Android
mailing list