[Android] fix crash if tab is changed while swiping in audiobrowser

Sébastien Toque git at videolan.org
Fri Jun 22 00:29:41 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Fri Jun 22 00:29:21 2012 +0200| [424a7f1afbb042971536feb56539275c74155880] | committer: Sébastien Toque

fix crash if tab is changed while swiping in audiobrowser

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=424a7f1afbb042971536feb56539275c74155880
---

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

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 802bcb6..24572f7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -372,6 +372,8 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
         @Override
         public void onSwitching(float progress) {
             LinearLayout hl = (LinearLayout)getActivity().findViewById(R.id.header_layout);
+            if (hl == null)
+                return;
             int width = hl.getChildAt(0).getWidth();
             int x = (int) (progress * width);
             mHeader.smoothScrollTo(x, 0);
@@ -380,6 +382,8 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
         @Override
         public void onSwitched(int position) {
             LinearLayout hl = (LinearLayout)getActivity().findViewById(R.id.header_layout);
+            if (hl == null)
+                return;
             TextView oldView = (TextView) hl.getChildAt(mCurrentPosition);
             oldView.setTextColor(Color.GRAY);
             TextView newView = (TextView) hl.getChildAt(position);



More information about the Android mailing list