summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/jni/ZT_jniutils.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/java/jni/ZT_jniutils.cpp b/java/jni/ZT_jniutils.cpp
index 411a836a..6faa91a4 100644
--- a/java/jni/ZT_jniutils.cpp
+++ b/java/jni/ZT_jniutils.cpp
@@ -313,11 +313,20 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
return NULL;
}
- jobject inetAddressObject = newInetAddress(env, addr);
+ jobject inetAddressObject = NULL;
+
+ if(addr.ss_family != 0)
+ {
+ inetAddressObject = newInetAddress(env, addr);
- if(env->ExceptionCheck() || inetAddressObject == NULL)
+ if(env->ExceptionCheck() || inetAddressObject == NULL)
+ {
+ LOGE("Error creating new inet address");
+ return NULL;
+ }
+ }
+ else
{
- LOGE("Error creating new inet address");
return NULL;
}
@@ -350,10 +359,9 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
break;
default:
{
- LOGE("ERROR: addr.ss_family is not set or unknown");
break;
}
- };
+ }
jobject inetSocketAddressObject = env->NewObject(inetSocketAddressClass, inetSocketAddress_constructor, inetAddressObject, port);