diff --git a/gsmmodem/pdu.py b/gsmmodem/pdu.py index a3e28e8..0ec07e4 100644 --- a/gsmmodem/pdu.py +++ b/gsmmodem/pdu.py @@ -465,8 +465,11 @@ def _decodeUserData(byteIter, userDataLen, dataCoding, udhPresent): # Since we are using 7-bit data, "fill bits" may have been added to make the UDH end on a septet boundary shift = ((udhLen + 1) * 8) % 7 # "fill bits" needed to make the UDH end on a septet boundary # Simulate another "shift" in the unpackSeptets algorithm in order to ignore the fill bits - prevOctet = next(byteIter) - shift += 1 + if shift: + prevOctet = next(byteIter) + shift += 1 + else: + prevOctet = 0 if dataCoding == 0x00: # GSM-7 if udhPresent: