add some index out of bounds checks to feeds/headline fragments

This commit is contained in:
Andrew Dolgov 2012-01-19 08:44:27 +03:00
parent 1e0f877b37
commit 7e08d4132f
2 changed files with 10 additions and 2 deletions

View File

@ -544,6 +544,10 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
} }
public Feed getFeedAtPosition(int position) { public Feed getFeedAtPosition(int position) {
try {
return m_adapter.getItem(position); return m_adapter.getItem(position);
} catch (IndexOutOfBoundsException e) {
return null;
}
} }
} }

View File

@ -519,7 +519,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
} }
public Article getArticleAtPosition(int position) { public Article getArticleAtPosition(int position) {
try {
return m_adapter.getItem(position); return m_adapter.getItem(position);
} catch (IndexOutOfBoundsException e) {
return null;
}
} }
public Article getArticleById(int id) { public Article getArticleById(int id) {