summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-05-24 11:46:03 +0200
committerMichal Cmarada <mcmarada@cisco.com>2019-05-24 11:46:03 +0200
commit5e0ae3d2f7e2723042c462c9851c0162df683556 (patch)
treeef23fc5df42d0789e0bf64754d862b331675f28f /java
parentfae82a77fec1ab43b0714210dd97378fd3f7b235 (diff)
fix length for string processing
In case string is null jstr_length crashes, this fixes the issue and returns 0 because null strings are replaced by empty strings later in process. Change-Id: Ib6b7a3985ae379207c4a06eb38df78dfdfbaffda Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'java')
-rw-r--r--java/jvpp-common/string_t.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/java/jvpp-common/string_t.h b/java/jvpp-common/string_t.h
index 8a2b3cc..adfcde9 100644
--- a/java/jvpp-common/string_t.h
+++ b/java/jvpp-common/string_t.h
@@ -27,6 +27,7 @@
// */
static size_t jstr_length(JNIEnv *env, jstring string)
{
+ if (string == NULL) return 0;
return ((int) (*env)->GetStringUTFLength(env, string));
}