jdk/src/windows/native/java/net/NetworkInterface_winXP.c
changeset 17206 3dfa000764e9
parent 17193 8b561b7fb87a
child 19827 082c76535c1f
child 20821 e0d0a585aa49
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Tue Apr 30 17:51:31 2013 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Wed May 01 10:03:39 2013 +0100
@@ -818,10 +818,12 @@
       ptr = getAdapter(env, index);
       if (ptr != NULL) {
         len = ptr->PhysicalAddressLength;
-        ret = (*env)->NewByteArray(env, len);
-        if (!IS_NULL(ret)) {
-          (*env)->SetByteArrayRegion(env, ret, 0, len,
-                                     (jbyte*) ptr->PhysicalAddress);
+        if (len > 0) {
+          ret = (*env)->NewByteArray(env, len);
+          if (!IS_NULL(ret)) {
+            (*env)->SetByteArrayRegion(env, ret, 0, len,
+                                       (jbyte*) ptr->PhysicalAddress);
+          }
         }
         free(ptr);
       }