Skip to content

Commit

Permalink
set middle_len for transfers without buffer blocks to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
masierra committed Mar 4, 2016
1 parent 9b1a1b0 commit a9e506d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/canard.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,18 @@ void canardHandleRxFrame(CanardInstance* ins, const CanardCANFrame* frame, uint6
}
else
{
uint16_t middle_len = 0;
// for transfers without buffer_blocks
if (rxstate->buffer_blocks != NULL)
{
middle_len = rxstate->payload_len - CANARD_RX_PAYLOAD_HEAD_SIZE;
}
CanardRxTransfer rxtransfer = {
.timestamp_usec = timestamp_usec,
.payload_head = rxstate->buffer_head,
.payload_middle = rxstate->buffer_blocks,
.payload_tail = frame->data,
.middle_len = rxstate->payload_len - CANARD_RX_PAYLOAD_HEAD_SIZE,
.middle_len = middle_len,
.payload_len = rxstate->payload_len + frame->data_len - 1,
.data_type_id = data_type_id,
.transfer_type = transfer_type,
Expand Down

0 comments on commit a9e506d

Please sign in to comment.