# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1679906783 0 # Node ID e5d2c74b1a51abf2f04fb838fdc4c5fb5975f07d # Parent ebb94fc2b19ff00c74858cdb08e8771ccf41c01d Android: Fixed a big in dw_window_get_text() introduced at some point. Also added a number of safety checks to prevent calling into kotlin with NULL. diff -r ebb94fc2b19f -r e5d2c74b1a51 android/dw.cpp --- a/android/dw.cpp Mon Mar 27 04:59:32 2023 +0000 +++ b/android/dw.cpp Mon Mar 27 08:46:23 2023 +0000 @@ -5229,7 +5229,7 @@ JNIEnv *env; int retval = DW_ERROR_GENERAL; - if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + if(handle && string && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { // Construct a String jstring jstr = env->NewStringUTF(string); @@ -5261,7 +5261,7 @@ JNIEnv *env; int retval = DW_ERROR_GENERAL; - if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + if(handle && url && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { // Construct a String jstring jstr = env->NewStringUTF(url); @@ -5294,7 +5294,7 @@ JNIEnv *env; int retval = DW_ERROR_GENERAL; - if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + if(handle && script && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { // Construct a String jstring jstr = env->NewStringUTF(script); @@ -6190,11 +6190,11 @@ char * API dw_window_get_text(HWND handle) { JNIEnv *env; + char *retval = nullptr; if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { const char *utf8 = nullptr; - char *retval = nullptr; // First get the class that contains the method you need to call jclass clazz = _dw_find_class(env, DW_CLASS_NAME); @@ -6212,7 +6212,7 @@ env->ReleaseStringUTFChars(result, utf8); } } - return nullptr; + return retval; } /*