Skip to content
Snippets Groups Projects
Commit d168fab2 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Audio adapter: Prevent NPE

Items can be null while medialibrary is loading them
parent 24d9f1df
No related branches found
No related tags found
No related merge requests found
......@@ -210,22 +210,21 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
}
public void onClick(View v) {
if (mIEventsHandler != null) {
int position = getLayoutPosition();
mIEventsHandler.onClick(v, position, getItem(position));
}
int position = getLayoutPosition();
final MediaLibraryItem item = getItem(position);
if (item != null) mIEventsHandler.onClick(v, position, item);
}
public void onMoreClick(View v) {
if (mIEventsHandler != null) {
int position = getLayoutPosition();
mIEventsHandler.onCtxClick(v, position, getItem(position));
}
int position = getLayoutPosition();
final MediaLibraryItem item = getItem(position);
if (item != null) mIEventsHandler.onCtxClick(v, position, item);
}
public boolean onLongClick(View view) {
int position = getLayoutPosition();
return mIEventsHandler.onLongClick(view, position, getItem(position));
final MediaLibraryItem item = getItem(position);
return item != null && mIEventsHandler.onLongClick(view, position, item);
}
private void setCoverlay(boolean selected) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment