[Android] Fix crashes after showSecondaryFragment call

Jean-Baptiste Kempf git at videolan.org
Mon Apr 7 20:29:51 CEST 2014


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr  7 20:29:19 2014 +0200| [40fe51b72970d9b4fa9a962522a9106214156817] | committer: Jean-Baptiste Kempf

Fix crashes after showSecondaryFragment call

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java   |    8 ++++++--
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java      |    4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

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 981b312..c1738ca 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -184,7 +184,9 @@ public class AudioBrowserFragment extends SherlockFragment {
             ArrayList<Media> mediaList = mArtistsAdapter.getMedia(p);
             MainActivity activity = (MainActivity)getActivity();
             AudioAlbumsSongsFragment frag = (AudioAlbumsSongsFragment)activity.showSecondaryFragment("albumsSongs");
-            frag.setMediaList(mediaList, mediaList.get(0).getArtist());
+            if (frag != null) {
+                frag.setMediaList(mediaList, mediaList.get(0).getArtist());
+            }
         }
     };
 
@@ -202,7 +204,9 @@ public class AudioBrowserFragment extends SherlockFragment {
             ArrayList<Media> mediaList = mGenresAdapter.getMedia(p);
             MainActivity activity = (MainActivity)getActivity();
             AudioAlbumsSongsFragment frag = (AudioAlbumsSongsFragment)activity.showSecondaryFragment("albumsSongs");
-            frag.setMediaList(mediaList, mediaList.get(0).getGenre());
+            if (frag != null) {
+                frag.setMediaList(mediaList, mediaList.get(0).getGenre());
+            }
         }
     };
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 9429f2e..77ccba5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -298,7 +298,9 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
         case R.id.video_list_info:
             MainActivity activity = (MainActivity)getActivity();
             MediaInfoFragment frag = (MediaInfoFragment)activity.showSecondaryFragment("mediaInfo");
-            frag.setMediaLocation(media.getLocation());
+            if (frag != null) {
+                frag.setMediaLocation(media.getLocation());
+            }
             return true;
         case R.id.video_list_delete:
             AlertDialog alertDialog = CommonDialogs.deleteMedia(



More information about the Android mailing list