diff options
author | Chris Robinson <[email protected]> | 2017-02-05 14:25:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-05 14:25:17 -0800 |
commit | af362c2d05097fce816b5c5d911d6650eb6bef37 (patch) | |
tree | ef1135e0520993248d05c7b0157e8899ac5a3c66 /Alc/backends | |
parent | 428cde5dc26191871111e1edbea85ade952898aa (diff) |
Fix for NULL JNIEnv
Which can happen with native-only apps
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/opensl.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index 1e4bcb06..08530d95 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -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. */ |