don/NDEF

Crashing on bad read

Opened this issue · 1 comments

Sometimes when nfc.read() and it fails to read the NDEF records the arduino crashes.

Stacktrace:
nfc.read()
MifareUltralight(uid, uidLength)
NdefMessage(buffer, messageLength()CRASH!

I think the issue is when the messageLength is set to 0, so fix this I suggest that we change the comparison operator in NdefMessage.cpp from:

`
...

while (index <= numBytes)

...`

to
`...

while (index < numBytes)

...`

I had those crashes too when I switched between different nfc tags in fast succession.
This solved the problem