Fix for JIRA IOT-2044.
[contrib/iotivity.git] / java / jni / JniOcRepresentation.cpp
index 042e2a4..27e96a9 100644 (file)
@@ -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);
 }