[Android] More crashes on mCurrentFragment

Jean-Baptiste Kempf git at videolan.org
Tue Apr 8 18:13:21 CEST 2014


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Apr  8 18:12:58 2014 +0200| [5855fec7360d8a555d53dfc865f045f5c77329d5] | committer: Jean-Baptiste Kempf

More crashes on mCurrentFragment

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 0584450..4cc4420 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -568,7 +568,7 @@ public class MainActivity extends SherlockFragmentActivity {
             menu.findItem(R.id.ml_menu_sortby).setVisible(true);
         }
         // Enable the clear search history function for the search fragment.
-        if (mCurrentFragment.equals("search"))
+        if (mCurrentFragment != null && mCurrentFragment.equals("search"))
             menu.findItem(R.id.search_clear_history).setVisible(true);
         return true;
     }
@@ -623,11 +623,11 @@ public class MainActivity extends SherlockFragmentActivity {
             // Refresh
             case R.id.ml_menu_refresh:
                 // TODO: factor this into each fragment
-                if(mCurrentFragment.equals("directories")) {
+                if(mCurrentFragment != null && mCurrentFragment.equals("directories")) {
                     DirectoryViewFragment directoryView = (DirectoryViewFragment) getFragment(mCurrentFragment);
                     directoryView.refresh();
                 }
-                else if(mCurrentFragment.equals("history"))
+                else if(mCurrentFragment != null && mCurrentFragment.equals("history"))
                     ((HistoryFragment) getFragment(mCurrentFragment)).refresh();
                 else
                     MediaLibrary.getInstance(this).loadMediaItems(this, true);



More information about the Android mailing list