From 69a80074eab27b3b3a6052fab2ca4c6d8c4dd3a1 Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 20 Aug 2019 22:45:00 +0100 Subject: [PATCH] Return empty string if wglGetExtensionsStringEXT is not supported --- gl-natives/src/main/c/jaggl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gl-natives/src/main/c/jaggl.c b/gl-natives/src/main/c/jaggl.c index 5f71b6c..946363b 100644 --- a/gl-natives/src/main/c/jaggl.c +++ b/gl-natives/src/main/c/jaggl.c @@ -748,26 +748,24 @@ JNIEXPORT void JNICALL Java_jaggl_context_setSwapInterval(JNIEnv *env, jclass cl JNIEXPORT jstring JNICALL Java_jaggl_context_getExtensionsString(JNIEnv *env, jclass cls) { JAGGL_LOCK(env); - jstring extensions; + const char *extensions_str; #if defined(__unix__) - const char *extensions_str = glXQueryExtensionsString(jaggl_display, jaggl_visual_info->screen); - extensions = (*env)->NewStringUTF(env, extensions_str); + extensions_str = glXQueryExtensionsString(jaggl_display, jaggl_visual_info->screen); #elif defined(_WIN32) if (jaggl_wglGetExtensionsStringEXT) { - const char *extensions_str = jaggl_wglGetExtensionsStringEXT(); - extensions = (*env)->NewStringUTF(env, extensions_str); + extensions_str = jaggl_wglGetExtensionsStringEXT(); } else { - extensions = NULL; + extensions_str = ""; } #elif defined(__APPLE__) && defined(__MACH__) - extensions = (*env)->NewStringUTF(env, ""); + extensions_str = ""; #else #error Unsupported platform #endif JAGGL_UNLOCK(env); - return extensions; + return (*env)->NewStringUTF(env, extensions_str); } JNIEXPORT jint JNICALL Java_jaggl_context_getAlphaBits(JNIEnv *env, jclass cls) {