Merge pull request #411 from simonduq/fix/coap_get_payload
CoAP: enable calling coap_get_payload with a NULL pointer
This commit is contained in:
commit
472e119c5c
@ -1115,13 +1115,10 @@ coap_set_header_size1(coap_message_t *coap_pkt, uint32_t size)
|
||||
int
|
||||
coap_get_payload(coap_message_t *coap_pkt, const uint8_t **payload)
|
||||
{
|
||||
if(coap_pkt->payload) {
|
||||
if(payload != NULL) {
|
||||
*payload = coap_pkt->payload;
|
||||
return coap_pkt->payload_len;
|
||||
} else {
|
||||
*payload = NULL;
|
||||
return 0;
|
||||
}
|
||||
return coap_pkt->payload != NULL ? coap_pkt->payload_len : 0;
|
||||
}
|
||||
int
|
||||
coap_set_payload(coap_message_t *coap_pkt, const void *payload, size_t length)
|
||||
|
Loading…
Reference in New Issue
Block a user