Handle missing account emojis on pixelfed instances
This commit is contained in:
parent
4e105e0fbc
commit
20dab7c77a
|
@ -49,7 +49,12 @@ public final class Account: AccountProtocol, Decodable {
|
||||||
self.avatarStatic = try? container.decode(URL.self, forKey: .avatarStatic)
|
self.avatarStatic = try? container.decode(URL.self, forKey: .avatarStatic)
|
||||||
self.header = try? container.decode(URL.self, forKey: .header)
|
self.header = try? container.decode(URL.self, forKey: .header)
|
||||||
self.headerStatic = try? container.decode(URL.self, forKey: .headerStatic)
|
self.headerStatic = try? container.decode(URL.self, forKey: .headerStatic)
|
||||||
self.emojis = try container.decode([Emoji].self, forKey: .emojis)
|
// even up-to-date pixelfed instances sometimes lack this, for reasons unclear
|
||||||
|
if let emojis = try container.decodeIfPresent([Emoji].self, forKey: .emojis) {
|
||||||
|
self.emojis = emojis
|
||||||
|
} else {
|
||||||
|
self.emojis = []
|
||||||
|
}
|
||||||
self.fields = (try? container.decode([Field].self, forKey: .fields)) ?? []
|
self.fields = (try? container.decode([Field].self, forKey: .fields)) ?? []
|
||||||
self.bot = try? container.decode(Bool.self, forKey: .bot)
|
self.bot = try? container.decode(Bool.self, forKey: .bot)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue