diff --git a/src/devices/Card/Ndef/NdefMessage.cs b/src/devices/Card/Ndef/NdefMessage.cs index 247ce1112f..6a5c324e01 100644 --- a/src/devices/Card/Ndef/NdefMessage.cs +++ b/src/devices/Card/Ndef/NdefMessage.cs @@ -70,8 +70,8 @@ public static (int Start, int Size) GetStartSizeNdef(Span toExtract) public static byte[]? ExtractMessage(Span toExtract) { var (idx, size) = GetStartSizeNdef(toExtract); - // Finally check that the end terminator TLV is 0xFE - bool isRealEnd = toExtract[idx + size] == 0xFE; + // Finally check that the optional end terminator TLV is 0xFE + bool isRealEnd = (toExtract.Length == idx + size) || (toExtract[idx + size] == 0xFE); if (!isRealEnd) { return new byte[0];