[Android] [PATCH 3/3] MainActivity: fix NPE (second try)

Thomas Guillem thomas at gllm.fr
Mon Oct 12 13:45:32 CEST 2015


---
 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..534327e 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);
+                }}
             }
         }
     }
-- 
2.1.4



More information about the Android mailing list