Don't access QByteArray out of bounds
QByteArray in Qt 5 allowed that with the non-const operator[] overload, Qt 6 does not.