From 5de95d4daf0429cfd00c04fabcaf2ec126022ff5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 9 Sep 2012 11:39:53 +0400 Subject: [PATCH] add null check to getArticlePosition() --- src/org/fox/ttrss/HeadlinesFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index c8d0ce2d..4cb77858 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -658,6 +658,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, return m_adapter.getItem(position); } catch (IndexOutOfBoundsException e) { return null; + } catch (NullPointerException e) { + return null; } } @@ -694,7 +696,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } public int getArticlePosition(Article article) { - return m_adapter.getPosition(article); + try { + return m_adapter.getPosition(article); + } catch (NullPointerException e) { + return -1; + } } public void setSearchQuery(String query) {