aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/alcbind.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/native/alcbind.c')
-rw-r--r--src/native/alcbind.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/native/alcbind.c b/src/native/alcbind.c
index 5933810..13fdef2 100644
--- a/src/native/alcbind.c
+++ b/src/native/alcbind.c
@@ -44,8 +44,10 @@ JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_alcGetErrorNative
JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative
(JNIEnv *env, jobject obj, jstring deviceName) {
jint result;
- ALubyte *str;
- str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL);
+ ALubyte *str = NULL;
+ if(deviceName == NULL) {
+ str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL);
+ }
ALCdevice *device;
device = alcOpenDevice(str);
(*env)->ReleaseStringUTFChars(env,deviceName,str);