Open ltAldoRaine opened 4 months ago
Hello, I'm trying to pass user properties to my publish message, but my application crashes with the error - Index Out of Range.
The error occurs in this method.
func unsignedByteToString(data:[UInt8], offset:Int) -> (resStr: String, newOffset: Int)?{ var newOffset = offset if offset + 1 > data.count { return nil } var length = 0 let comRes = integerCompute(data: data, formatType: formatInt.formatUint16.rawValue, offset: newOffset) length = comRes!.res newOffset = comRes!.newOffset var stringData = Data() for _ in 0 ..< length { stringData.append(**data[newOffset]**) // here newOffset += 1 } guard let res = String(data: stringData, encoding: .utf8) else { return nil } return (res, newOffset) }
Hello, I'm trying to pass user properties to my publish message, but my application crashes with the error - Index Out of Range.
The error occurs in this method.