[Android] Check getActivity is not null

Geoffrey Métais git at videolan.org
Thu Jun 23 10:46:20 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 23 10:32:05 2016 +0200| [5656486984a39aa19528ebf96c401c990787aeae] | committer: Geoffrey Métais

Check getActivity is not null

(cherry picked from commit 8493e2174dbb4478df92425ef79c0789effa8577)

> https://code.videolan.org/videolan/vlc-android/commit/5656486984a39aa19528ebf96c401c990787aeae
---

 vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index 9ba9f60..d0bf9d0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -139,11 +139,12 @@ public class HistoryFragment extends MediaBrowserFragment implements IRefreshabl
         public void handleMessage(Message msg) {
             switch (msg.what){
                 case UPDATE_LIST:
+                    if (getActivity() == null)
+                        return;
                     mHistoryAdapter.setList((ArrayList<MediaWrapper>) msg.obj);
                     updateEmptyView();
-                    if( mHistoryAdapter != null ) {
+                    if (mHistoryAdapter != null)
                         mHistoryAdapter.notifyDataSetChanged();
-                    }
                     mSwipeRefreshLayout.setRefreshing(false);
                     getActivity().supportInvalidateOptionsMenu();
             }



More information about the Android mailing list