From: Jee Hyeok Kim Date: Mon, 24 Oct 2016 02:57:14 +0000 (+0900) Subject: Fix aircon_controller crash issue X-Git-Tag: 1.2.1~241 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc4395fdd9679a47fc61d990cfc45d15545cedff;p=platform%2Fupstream%2Fiotivity.git Fix aircon_controller crash issue 1. Fix crash issue Change-Id: I6033e3272ce8f085730e1b579e026ef079bd7097 Signed-off-by: Jee Hyeok Kim Reviewed-on: https://gerrit.iotivity.org/gerrit/13581 Tested-by: jenkins-iotivity Reviewed-by: Glen Youngjin Kim --- diff --git a/cloud/samples/client/airconditioner/aircon_controller.cpp b/cloud/samples/client/airconditioner/aircon_controller.cpp index bc9a929a1..fa1cd91f9 100644 --- a/cloud/samples/client/airconditioner/aircon_controller.cpp +++ b/cloud/samples/client/airconditioner/aircon_controller.cpp @@ -22,7 +22,7 @@ string g_uid; string g_accesstoken; string g_host; -OC::OCResource::Ptr g_binaryswitchResource; +OC::OCResource::Ptr g_binaryswitchResource = nullptr; void printRepresentation(OCRepresentation rep) { @@ -154,6 +154,12 @@ void onPost(const HeaderOptions & /*headerOptions*/, const OCRepresentation &rep void turnOnOffSwitch(bool toTurn) { + if (g_binaryswitchResource == nullptr) + { + cout << "Binary switch not found" << endl; + return; + } + OCRepresentation binarySwitch; binarySwitch.setValue("value", toTurn);