diff --git a/Sources/LowEnergyCommandParameter.swift b/Sources/LowEnergyCommandParameter.swift index 03cc8803a..8ea2b98a3 100644 --- a/Sources/LowEnergyCommandParameter.swift +++ b/Sources/LowEnergyCommandParameter.swift @@ -26,6 +26,8 @@ public extension LowEnergyCommand { public init(data: LowEnergyAdvertisingData, length: UInt8) { + precondition(length <= 31, "LE Advertising Data can only be 31 octets") + self.length = length self.data = data } @@ -156,6 +158,8 @@ public extension LowEnergyCommand { public init(data: LowEnergyScanData, length: UInt8) { + precondition(length <= 31, "LE Scan Response Data can only be 31 octets") + self.length = length self.data = data }