Commit 7a66fbdd authored by Geoffrey Métais's avatar Geoffrey Métais

Prevent NPE on TV browsers

parent cc5bbad8
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package org.videolan.vlc.gui.tv.browser; package org.videolan.vlc.gui.tv.browser;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
...@@ -181,11 +182,14 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br ...@@ -181,11 +182,14 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
@Override @Override
public void updateList() { public void updateList() {
Activity activity = getActivity();
if (activity == null)
return;
mAdapter.clear(); mAdapter.clear();
ArrayObjectAdapter adapter; ArrayObjectAdapter adapter;
HeaderItem header; HeaderItem header;
for (ListItem item : mMediaItemMap.values()){ for (ListItem item : mMediaItemMap.values()){
adapter = new ArrayObjectAdapter(new CardPresenter(getActivity())); adapter = new ArrayObjectAdapter(new CardPresenter(activity));
header = new HeaderItem(0, item.Letter); header = new HeaderItem(0, item.Letter);
adapter.addAll(0, item.mediaList); adapter.addAll(0, item.mediaList);
mAdapter.add(new ListRow(header, adapter)); mAdapter.add(new ListRow(header, adapter));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment