From 7e08d4132fc56086446a6766d55404eb04e22744 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 19 Jan 2012 08:44:27 +0300 Subject: [PATCH] add some index out of bounds checks to feeds/headline fragments --- src/org/fox/ttrss/FeedsFragment.java | 6 +++++- src/org/fox/ttrss/HeadlinesFragment.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index bb823dd0..430194e5 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -544,6 +544,10 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh } public Feed getFeedAtPosition(int position) { - return m_adapter.getItem(position); + try { + return m_adapter.getItem(position); + } catch (IndexOutOfBoundsException e) { + return null; + } } } diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 0e7b718f..6c66b3aa 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -519,7 +519,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } public Article getArticleAtPosition(int position) { - return m_adapter.getItem(position); + try { + return m_adapter.getItem(position); + } catch (IndexOutOfBoundsException e) { + return null; + } } public Article getArticleById(int id) {