1. Fix crash issue
Change-Id: I6033e3272ce8f085730e1b579e026ef079bd7097
Signed-off-by: Jee Hyeok Kim <jihyeok13.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13581
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Glen Youngjin Kim <glen.kim@samsung.com>
string g_accesstoken;
string g_host;
-OC::OCResource::Ptr g_binaryswitchResource;
+OC::OCResource::Ptr g_binaryswitchResource = nullptr;
void printRepresentation(OCRepresentation rep)
{
void turnOnOffSwitch(bool toTurn)
{
+ if (g_binaryswitchResource == nullptr)
+ {
+ cout << "Binary switch not found" << endl;
+ return;
+ }
+
OCRepresentation binarySwitch;
binarySwitch.setValue("value", toTurn);