[Android] src: Check for NULL in AudioBrowserFragment

Edward Wang git at videolan.org
Sat Aug 4 15:59:14 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Aug  4 09:59:01 2012 -0400| [aea28f48a3f04a4d6b53bb6562dc9488c2d49ddd] | committer: Edward Wang

src: Check for NULL in AudioBrowserFragment

getMenuInfo() can be null.

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java       |    4 +++-
 1 file changed, 3 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 8ee6e01..bb6e1bb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -243,6 +243,9 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
 
     @Override
     public boolean onContextItemSelected(MenuItem item) {
+        ContextMenuInfo menuInfo = item.getMenuInfo();
+        if(menuInfo == null) return super.onContextItemSelected(item);
+
         int startPosition;
         int groupPosition;
         int childPosition;
@@ -254,7 +257,6 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
         boolean append = (id == R.id.audio_list_browser_append ||
                           id == R.id.audio_list_browser_append_all);
 
-        ContextMenuInfo menuInfo = item.getMenuInfo();
         if (ExpandableListContextMenuInfo.class.isInstance(menuInfo)) {
             ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
             groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);



More information about the Android mailing list