CoAP: enable calling coap_get_payload with a NULL pointer
This commit is contained in:
parent
9a409bf264
commit
0df3c4fb90
@ -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