headlines: in onContextItemSelected check if adapter context menu info is there

This commit is contained in:
Andrew Dolgov 2017-06-08 18:46:34 +03:00
parent 7bdfe419aa
commit f172c5b2ac

View File

@ -249,12 +249,15 @@ public class HeadlinesFragment extends Fragment {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); .getMenuInfo();
Article article = getArticleAtPosition(info.position - m_adapter.getHeaderCount()); if (info != null) {
if (!onArticleMenuItemSelected(item, article, info.position)) Article article = getArticleAtPosition(info.position - m_adapter.getHeaderCount());
return super.onContextItemSelected(item);
else if (!onArticleMenuItemSelected(item, article, info.position))
return true; return super.onContextItemSelected(item);
}
return super.onContextItemSelected(item);
} }
public HeadlinesFragment() { public HeadlinesFragment() {