LogAndReturnTizenError(res, ("creating handle failed"));
}
- // options is optional nullable. if it's not present, just ignore it
+ // options is optional nullable. if it's not present or is null, just ignore it
auto options_it = source.find(kOptions);
if (source.end() != options_it) {
- const auto& options_array = options_it->second.get<picojson::array>();
iotcon_options_h options = nullptr;
- res = IotconUtils::OptionsFromJson(options_array, &options);
- if (!res) {
- return res;
+ // if array supplied, set it. Other cases just clear options with nullptr
+ if (options_it->second.is<picojson::array>()) {
+ const auto& options_array = options_it->second.get<picojson::array>();
+ res = IotconUtils::OptionsFromJson(options_array, &options);
+ if (!res) {
+ return res;
+ }
}
res = IotconUtils::ConvertIotconError(iotcon_remote_resource_set_options((*ptr)->handle, options));
if (!res) {