diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2019-05-24 11:46:03 +0200 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2019-05-24 11:46:03 +0200 |
commit | 5e0ae3d2f7e2723042c462c9851c0162df683556 (patch) | |
tree | ef23fc5df42d0789e0bf64754d862b331675f28f | |
parent | fae82a77fec1ab43b0714210dd97378fd3f7b235 (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>
-rw-r--r-- | java/jvpp-common/string_t.h | 1 |
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)); } |