Skip to content

Commit

Permalink
Add null check to handle empty payload
Browse files Browse the repository at this point in the history
  • Loading branch information
connyan authored and SodaqMoja committed Feb 7, 2018
1 parent c83ec6a commit 2c8650f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Sodaq_RN2483.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,11 @@ uint8_t Sodaq_RN2483::onMacRX()
// payload
token = strtok(NULL, " "); // until end of string

if (!token) {
debugPrintLn("[onMacRX]: packet contains no payload.");
return NoError;
}

uint16_t len = strlen(token) + 1; // include termination char
uint16_t start = (token - _inputBuffer);
uint16_t inputIndex = start;
Expand Down

0 comments on commit 2c8650f

Please sign in to comment.