Fixes the case where the SDK would read an empty string from the Db and would throw this error incorrectly closes #1037
This commit is contained in:
parent
355a3fc4f5
commit
cf53edb3b8
|
@ -211,7 +211,7 @@ extension Array where Element == UInt8 {
|
|||
.reversed()
|
||||
.first(where: { $0.1 != 0 })
|
||||
.map({ $0.0 + 1 }) else {
|
||||
return [UInt8](self[0 ..< 1])
|
||||
return []
|
||||
}
|
||||
|
||||
return [UInt8](self[0 ..< lastNullByte])
|
||||
|
|
|
@ -77,6 +77,12 @@ class MemoTests: XCTestCase {
|
|||
let memo: Memo = .arbitrary(Self.validMemoDataExpectedString.data(using: .utf8)!.bytes)
|
||||
XCTAssertNil(memo.toString())
|
||||
}
|
||||
|
||||
func testEmptyTextMemo() throws {
|
||||
let emptyMemoBytes = try MemoBytes(bytes: [])
|
||||
|
||||
XCTAssertNoThrow(try emptyMemoBytes.intoMemo())
|
||||
}
|
||||
|
||||
/**
|
||||
*******
|
||||
|
|
Loading…
Reference in New Issue