Skip to content

Commit

Permalink
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Sources/GAPData.swift
Original file line number Diff line number Diff line change
@@ -215,12 +215,25 @@ public struct GAPDataDecoder {
// get length
let length = Int(data[index]) // 0
index += 1
guard index < data.count
else { throw Error.insufficientBytes(expected: index + 1, actual: data.count) }
guard index < data.count else {

if length == 0 {

break // EOF

} else {

throw Error.insufficientBytes(expected: index + 1, actual: data.count)
}
}

// get type
let type = GAPDataType(rawValue: data[index]) // 1

// ignore zeroed bytes
guard (type.rawValue == 0 && length == 0) == false
else { break }

// get value
let value: Data

0 comments on commit eb90ee8

Please sign in to comment.