diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineFeedsFragment.java | 20 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 20 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java index a2231485..839f22df 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java @@ -121,13 +121,19 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene } public void refresh() { - if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); - - m_cursor = createCursor(); - - if (m_cursor != null) { - m_adapter.changeCursor(m_cursor); - m_adapter.notifyDataSetChanged(); + try { + if (!isAdded()) return; + + if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); + + m_cursor = createCursor(); + + if (m_cursor != null && m_adapter != null) { + m_adapter.changeCursor(m_cursor); + m_adapter.notifyDataSetChanged(); + } + } catch (NullPointerException e) { + e.printStackTrace(); } } diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 9ee61684..0eeeee6f 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -256,13 +256,19 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis } public void refresh() { - if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); - - m_cursor = createCursor(); - - if (m_cursor != null) { - m_adapter.changeCursor(m_cursor); - m_adapter.notifyDataSetChanged(); + try { + if (!isAdded()) return; + + if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); + + m_cursor = createCursor(); + + if (m_cursor != null && m_adapter != null) { + m_adapter.changeCursor(m_cursor); + m_adapter.notifyDataSetChanged(); + } + } catch (NullPointerException e) { + e.printStackTrace(); } } |