[Android] FilePickerAdapter: Prevent ClassCastException
Geoffrey Métais
git at videolan.org
Thu Sep 28 11:41:47 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 28 11:20:52 2017 +0200| [95293d9641d57db346f19407dcbbcc4fcab84a7a] | committer: Geoffrey Métais
FilePickerAdapter: Prevent ClassCastException
> https://code.videolan.org/videolan/vlc-android/commit/95293d9641d57db346f19407dcbbcc4fcab84a7a
---
.../org/videolan/vlc/gui/browser/FilePickerAdapter.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
index 590233a5a..5e09f63e0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
@@ -42,12 +42,14 @@ public class FilePickerAdapter extends BaseBrowserAdapter {
}
public void onBindViewHolder(final ViewHolder holder, int position) {
- final MediaViewHolder vh = (MediaViewHolder) holder;
- final MediaWrapper media = (MediaWrapper) getItem(position);
- vh.binding.setItem(media);
- vh.binding.setHasContextMenu(false);
- vh.binding.setProtocol(null);
- vh.binding.setCover(getIcon(media));
+ if (holder instanceof MediaViewHolder) {
+ final MediaViewHolder vh = (MediaViewHolder) holder;
+ final MediaWrapper media = (MediaWrapper) getItem(position);
+ vh.binding.setItem(media);
+ vh.binding.setHasContextMenu(false);
+ vh.binding.setProtocol(null);
+ vh.binding.setCover(getIcon(media));
+ }
}
//TODO update with different filter types in other cases than subtitles selection
More information about the Android
mailing list