[Android] Prevent weird (Samsung...) NPE

Geoffrey Métais git at videolan.org
Tue Mar 3 10:17:39 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar  3 10:03:01 2015 +0100| [a87c8dd5fa8e6d14a831ecc3b96c70685df35807] | committer: Geoffrey Métais

Prevent weird (Samsung...) NPE

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a87c8dd5fa8e6d14a831ecc3b96c70685df35807
---

 NEWS                                                                |    1 +
 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java        |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6884ebd..2406b78 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Changes between 1.1.2 and 1.1.3-git:
 
 Main Application:
  * Fix LG bug with menu button
+ * Fix rare NPE for Samsung devices 
 
 Changes between 1.1.1 and 1.1.2:
 --------------------------------
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index d847c6d..eab8739 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -186,7 +186,8 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
                 boolean enabled = scrollState == SCROLL_STATE_IDLE;
                 if (enabled) {
                     enabled = view.getFirstVisiblePosition() == 0;
-                    enabled &= view.getChildAt(0).getTop() == 0;
+                    if (view.getChildAt(0) != null)
+                        enabled &= view.getChildAt(0).getTop() == 0;
                 }
                 mSwipeRefreshLayout.setEnabled(enabled);
             }



More information about the Android mailing list