[Android] Prevent NPE on TV browsers
Geoffrey Métais
git at videolan.org
Thu Aug 25 14:48:52 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 25 13:24:02 2016 +0200| [7a66fbddd96da475f0bff6d4eccfee30a06a40c6] | committer: Geoffrey Métais
Prevent NPE on TV browsers
> https://code.videolan.org/videolan/vlc-android/commit/7a66fbddd96da475f0bff6d4eccfee30a06a40c6
---
.../src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index eab682c..c22e99d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -24,6 +24,7 @@
package org.videolan.vlc.gui.tv.browser;
import android.annotation.TargetApi;
+import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
@@ -181,11 +182,14 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
@Override
public void updateList() {
+ Activity activity = getActivity();
+ if (activity == null)
+ return;
mAdapter.clear();
ArrayObjectAdapter adapter;
HeaderItem header;
for (ListItem item : mMediaItemMap.values()){
- adapter = new ArrayObjectAdapter(new CardPresenter(getActivity()));
+ adapter = new ArrayObjectAdapter(new CardPresenter(activity));
header = new HeaderItem(0, item.Letter);
adapter.addAll(0, item.mediaList);
mAdapter.add(new ListRow(header, adapter));
More information about the Android
mailing list