fixed code to get token about the empty message
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Mon, 28 Mar 2016 08:25:07 +0000 (17:25 +0900)
committerJon A. Cruz <jon@joncruz.org>
Thu, 7 Apr 2016 23:48:32 +0000 (23:48 +0000)
fixed code to get token about the empty message

Change-Id: Ifbe334f42457c1b2ba801d92cdca540433689938
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7387
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7433
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
resource/csdk/connectivity/src/cablockwisetransfer.c

index e59ba36..ad4cee3 100644 (file)
@@ -1441,7 +1441,6 @@ CAResult_t CAAddBlockOption(coap_pdu_t **pdu, const CAInfo_t *info,
         else
         {
             OIC_LOG(INFO, TAG, "not Blockwise Transfer");
-            goto exit;
         }
     }
 
@@ -1450,11 +1449,15 @@ CAResult_t CAAddBlockOption(coap_pdu_t **pdu, const CAInfo_t *info,
     {
         // if received message type is RESET from remote device,
         // we have to use the updated message id of request message to find token.
-        res = CAUpdateMessageId(*pdu, blockDataID);
-        if (CA_STATUS_OK != res)
+        CABlockData_t *blockData = CAGetBlockDataFromBlockDataList(blockDataID);
+        if (blockData)
         {
-            OIC_LOG(ERROR, TAG, "fail to update message id");
-            goto exit;
+            res = CAUpdateMessageId(*pdu, blockDataID);
+            if (CA_STATUS_OK != res)
+            {
+                OIC_LOG(ERROR, TAG, "fail to update message id");
+                goto exit;
+            }
         }
     }