diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-08-01 07:59:06 +0200 |
---|---|---|
committer | Keith Burns <alagalah@gmail.com> | 2016-08-02 14:27:33 +0000 |
commit | 8e5458caea3f58664dd001d65bbda5e12482a8ae (patch) | |
tree | 75697329984e0590ac9cee2728bdc128ae5ecb12 /vpp-api | |
parent | 7b75d211ae7b28ace7c6eee8e00005a0c45df45d (diff) |
VPP-229: fix NPE in JNI array handling
Change-Id: Ieb5182a7a3612e09bd2b28eb6a4abbdb4d29d34b
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-api')
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_c_gen.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_c_gen.py b/vpp-api/java/jvpp/gen/jvpp_c_gen.py index 60e75b1a2e6..4d0ea0b51d1 100644 --- a/vpp-api/java/jvpp/gen/jvpp_c_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_c_gen.py @@ -107,7 +107,7 @@ u64_struct_setter_template = Template(""" mp->${c_name} = clib_host_to_net_u64(${java_name});""") u8_array_struct_setter_template = Template(""" - { + if (${java_name}) { jsize cnt = (*env)->GetArrayLength (env, ${java_name}); size_t max_size = ${field_length}; if (max_size != 0 && cnt > max_size) cnt = max_size; @@ -117,7 +117,7 @@ u8_array_struct_setter_template = Template(""" u16_array_struct_setter_template = Template(""" jshort * ${java_name}ArrayElements = (*env)->GetShortArrayElements(env, ${java_name}, NULL); - { + if (${java_name}) { size_t _i; jsize cnt = (*env)->GetArrayLength (env, ${java_name}); size_t max_size = ${field_length}; @@ -131,7 +131,7 @@ u16_array_struct_setter_template = Template(""" u32_array_struct_setter_template = Template(""" jint * ${java_name}ArrayElements = (*env)->GetIntArrayElements(env, ${java_name}, NULL); - { + if (${java_name}) { size_t _i; jsize cnt = (*env)->GetArrayLength (env, ${java_name}); size_t max_size = ${field_length}; @@ -145,7 +145,7 @@ u32_array_struct_setter_template = Template(""" u64_array_struct_setter_template = Template(""" jlong * ${java_name}ArrayElements = (*env)->GetLongArrayElements(env, ${java_name}, NULL); - { + if (${java_name}) { size_t _i; jsize cnt = (*env)->GetArrayLength (env, ${java_name}); size_t max_size = ${field_length}; |