fix crash when opening context menu on feed/cats fragments w/ header (2)

This commit is contained in:
Andrew Dolgov 2015-02-11 21:25:27 +03:00
parent 1e0a0387ca
commit 8dc231e8cc
2 changed files with 8 additions and 4 deletions

View File

@ -190,7 +190,13 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
}
public FeedCategory getCategoryAtPosition(int position) {
return m_adapter.getItem(position);
try {
return (FeedCategory) m_list.getItemAtPosition(position);
} catch (NullPointerException e) {
return null;
} catch (IndexOutOfBoundsException e) {
return null;
}
}
@Override

View File

@ -856,9 +856,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
public Feed getFeedAtPosition(int position) {
try {
ListView list = (ListView) getView().findViewById(R.id.feeds);
return (Feed) list.getItemAtPosition(position);
return (Feed) m_list.getItemAtPosition(position);
} catch (NullPointerException e) {
return null;
} catch (IndexOutOfBoundsException e) {