sensor: rec: allow option parameter that can be NULL 86/130286/1
authorkibak.yoon <kibak.yoon@samsung.com>
Sun, 21 May 2017 07:06:23 +0000 (16:06 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Sun, 21 May 2017 07:07:35 +0000 (16:07 +0900)
Change-Id: I037246fc8f4d924b9af131d523c40f36557d1cd0
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/client/sensor_recorder.cpp

index f57fae3..e599b34 100644 (file)
@@ -66,9 +66,12 @@ EXPORT_API int ctx_sensor_rec_is_supported(const char* subject, bool *supported)
 
 EXPORT_API int ctx_sensor_rec_start(const char* subject, ctx_sensor_rec_option_h option)
 {
-       IF_FAIL_RETURN(subject && option, E_PARAM);
+       IF_FAIL_RETURN(subject, E_PARAM);
+
+       std::string optionStr("");
 
-       std::string optionStr = __mapToJson(*static_cast<ctx_sensor_rec_option_t*>(option));
+       if (option)
+               optionStr = __mapToJson(*static_cast<ctx_sensor_rec_option_t*>(option));
        GVariant* param = g_variant_new("(ss)", subject, optionStr.c_str());
 
        return __getServiceProxy()->call(METHOD_START_REC, param);