[Android] MainActivity: fix NPE (second try)

Thomas Guillem git at videolan.org
Mon Oct 12 15:46:20 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Oct 12 14:08:24 2015 +0200| [cee2ce8c238d73a358942a51ef4c078498d70937] | committer: Jean-Baptiste Kempf

MainActivity: fix NPE (second try)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    8 +++++---
 1 file changed, 5 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 2f33978..150bb17 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -536,9 +536,11 @@ public class MainActivity extends AudioPlayerContainerActivity implements OnItem
             if (resultCode == PreferencesActivity.RESULT_RESCAN)
                 mMediaLibrary.scanMediaItems(true);
             else if (resultCode == PreferencesActivity.RESULT_RESTART) {
-                Intent intent = new Intent(getIntent());
-                finish();
-                startActivity(intent);
+                final Intent intent = getIntent();
+                if (intent != null && intent.getAction() != null) {
+                    finish();
+                    startActivity(intent);
+                }
             }
         }
     }



More information about the Android mailing list