[Android] Audio browser: fix a null pointer exception.

Adrien Maglo git at videolan.org
Fri Nov 15 22:18:21 CET 2013


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Nov 15 22:14:36 2013 +0100| [882973ad8aae6ff56c9e72dc757367df44b6426d] | committer: Adrien Maglo

Audio browser: fix a null pointer exception.

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java      |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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 5ddedd5..90665a9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -154,7 +154,10 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
         v.getViewTreeObserver().addOnGlobalLayoutListener(
                 new ViewTreeObserver.OnGlobalLayoutListener() {
                     public void onGlobalLayout() {
-                        LinearLayout hl = (LinearLayout)getView().findViewById(R.id.header_layout);
+                        View v = getView();
+                        if (v == null)
+                            return;
+                        LinearLayout hl = (LinearLayout)v.findViewById(R.id.header_layout);
                         for (int i = 0; i < hl.getChildCount(); ++i) {
                             View t = (View)hl.getChildAt(i);
                             int width = getView().getWidth() / 2;



More information about the Android mailing list