[Android] Fix potential NPE

Geoffrey Métais git at videolan.org
Mon Mar 7 15:46:35 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar  7 13:43:34 2016 +0100| [d011edeb9844fefe31402535e626e7323b486838] | committer: Geoffrey Métais

Fix potential NPE

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

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java   | 2 ++
 .../src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 12e2199..ac5f4af 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -344,6 +344,8 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         @Override
         public void handleMessage(Message msg) {
             BaseBrowserFragment fragment = getOwner();
+            if (fragment == null)
+                return;
             switch (msg.what){
                 case MSG_SHOW_LOADING:
                     fragment.mSwipeRefreshLayout.setRefreshing(true);
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index 84cd2bb..be51664 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -251,6 +251,8 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
             SortedBrowserFragment owner = getOwner();
+            if (owner == null)
+                return;
             switch (msg.what) {
                 case UPDATE_ITEM:
                     owner.updateItem((MediaWrapper)msg.obj);



More information about the Android mailing list