Filter out an exceptional case if a response payload of discovery is NULL
authorJihun Ha <jihun.ha@samsung.com>
Mon, 22 May 2017 10:58:53 +0000 (19:58 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 22 May 2017 15:32:08 +0000 (15:32 +0000)
If a response payload of discovery is NULL, which means discovery request
is failed for some reason, it should not proceed a further operation.
Only if a result of discovery request is OK, GET/PUT/POST requests can be
performed, further.

Change-Id: I95e79038dfae5e455f61db89aa9c7f3a724cee29
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20245
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Glen Youngjin Kim <glen.kim@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 049fbc6..9381a81
@@ -248,7 +248,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
         OIC_LOG(ERROR, TAG, "\n<====Callback Context for DISCOVERY fail====>");
     }
 
-    if (clientResponse)
+    if (clientResponse && clientResponse->result == OC_STACK_OK)
     {
         OIC_LOG_V(INFO, TAG,
                 "Device =============> Discovered @ %s:%d",