Fix for NULL JNIEnv
Which can happen with native-only apps
This commit is contained in:
@@ -1179,6 +1179,12 @@ static void CleanupJNIEnv(void* UNUSED(ptr))
|
||||
|
||||
void *Android_GetJNIEnv(void)
|
||||
{
|
||||
if(!gJavaVM)
|
||||
{
|
||||
WARN("gJavaVM is NULL!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* http://developer.android.com/guide/practices/jni.html
|
||||
*
|
||||
* All threads are Linux threads, scheduled by the kernel. They're usually
|
||||
|
||||
@@ -237,13 +237,11 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device)
|
||||
SLInterfaceID id;
|
||||
SLresult result;
|
||||
SLboolean req;
|
||||
JNIEnv *env;
|
||||
|
||||
if((Device->Flags&DEVICE_FREQUENCY_REQUEST))
|
||||
sampleRate = Device->Frequency;
|
||||
else
|
||||
sampleRate = Device->Frequency;
|
||||
if(!(Device->Flags&DEVICE_FREQUENCY_REQUEST) && (env=Android_GetJNIEnv()) != NULL)
|
||||
{
|
||||
JNIEnv *env = Android_GetJNIEnv();
|
||||
|
||||
/* Get necessary stuff for using java.lang.Integer,
|
||||
* android.content.Context, and android.media.AudioManager.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user