From 415e986b1a8fd7a28783e06a5b224b35e4310ef5 Mon Sep 17 00:00:00 2001 From: Senthil Kumar G S Date: Thu, 13 Apr 2017 20:30:51 +0530 Subject: [PATCH] Fix for JIRA IOT-2044. Handled "GetStringUTFChars received NULL jstring" error Change-Id: I67aecab98e496ec715e634246d4ee32efc44aa8b Signed-off-by: Senthil Kumar G S Reviewed-on: https://gerrit.iotivity.org/gerrit/18927 Reviewed-by: Jihun Ha Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Tested-by: Uze Choi --- java/jni/JniOcRepresentation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/jni/JniOcRepresentation.cpp b/java/jni/JniOcRepresentation.cpp index 042e2a4..27e96a9 100644 --- a/java/jni/JniOcRepresentation.cpp +++ b/java/jni/JniOcRepresentation.cpp @@ -196,7 +196,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setValueStringN } std::string key = env->GetStringUTFChars(jKey, nullptr); - std::string value = env->GetStringUTFChars(jValue, nullptr); + std::string value; + if(jValue) + value = env->GetStringUTFChars(jValue, nullptr); rep->setValue(key, value); } -- 2.7.4