diff --git a/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/src/solaris/native/java/net/PlainDatagramSocketImpl.c index 0fb06a9f78b7ef46faffb78e2dfff295cf3620e9..1fb3eef4fde22a593169c1c47f517aecc09eb172 100644 --- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c +++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c @@ -1143,7 +1143,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val jobject addr; int i; - if (ni_addrsID == NULL) { + if (ni_addrsID == NULL || ia_addressID == NULL) { jclass c = (*env)->FindClass(env, "java/net/NetworkInterface"); CHECK_NULL(c); ni_addrsID = (*env)->GetFieldID(env, c, "addrs", diff --git a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c index 77633f4e40ac819ab2bc7d14d14df1f48ff00f36..227ef3c861fad245cdcc74364b2017b14d875997 100644 --- a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c +++ b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c @@ -1579,7 +1579,7 @@ static int getInetAddrFromIf (JNIEnv *env, int family, jobject nif, jobject *iad jobject addr; int i; - if (ni_addrsID == NULL) { + if (ni_addrsID == NULL || ia_familyID == NULL) { jclass c = (*env)->FindClass(env, "java/net/NetworkInterface"); CHECK_NULL_RETURN (c, -1); ni_addrsID = (*env)->GetFieldID(env, c, "addrs",