[vlc-devel] [vlc-android] [PATCH 1/2] Only check the preferences if we actually have an activity
Martin Storsjö
martin at martin.st
Wed Oct 12 11:57:41 CEST 2011
This avoids a crash if this happens to be called without
an instance of the main activity existing.
---
.../src/org/videolan/vlc/android/LibVLC.java | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/android/LibVLC.java b/vlc-android/src/org/videolan/vlc/android/LibVLC.java
index 370799c..fb45a88 100644
--- a/vlc-android/src/org/videolan/vlc/android/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/android/LibVLC.java
@@ -121,7 +121,10 @@ public class LibVLC {
{
Log.v(TAG, "Initializing LibVLC");
if (!mIsInitialized) {
- boolean useIomx = PreferenceManager.getDefaultSharedPreferences(MainActivity.getInstance()).getBoolean("enable_iomx", false);
+ MainActivity activity = MainActivity.getInstance();
+ boolean useIomx = false;
+ if (activity != null)
+ useIomx = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("enable_iomx", false);
nativeInit(useIomx);
setEventManager(EventManager.getIntance());
mIsInitialized = true;
--
1.7.2.5
More information about the vlc-devel
mailing list