mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-03 19:30:09 +00:00
Fix empty object encoding
This commit is contained in:
parent
bfa66cce6c
commit
adbb6f6129
@ -42,7 +42,28 @@ final class _AdaptedPostboxEncoder {
|
||||
}
|
||||
|
||||
func makeData(addHeader: Bool, isDictionary: Bool) -> (Data, ValueType) {
|
||||
return self.container!.makeData(addHeader: addHeader, isDictionary: isDictionary)
|
||||
if let container = self.container {
|
||||
return container.makeData(addHeader: addHeader, isDictionary: isDictionary)
|
||||
} else {
|
||||
let buffer = WriteBuffer()
|
||||
|
||||
if addHeader {
|
||||
var typeHash: Int32 = self.typeHash
|
||||
buffer.write(&typeHash, offset: 0, length: 4)
|
||||
}
|
||||
|
||||
let innerEncoder = PostboxEncoder()
|
||||
let data = innerEncoder.makeData()
|
||||
|
||||
if addHeader {
|
||||
var length: Int32 = Int32(data.count)
|
||||
buffer.write(&length, offset: 0, length: 4)
|
||||
}
|
||||
|
||||
buffer.write(data)
|
||||
|
||||
return (buffer.makeData(), .Object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user