diff --git a/Packages/Pachyderm/Sources/Pachyderm/Model/Account.swift b/Packages/Pachyderm/Sources/Pachyderm/Model/Account.swift index 646254b8..baf2d1e7 100644 --- a/Packages/Pachyderm/Sources/Pachyderm/Model/Account.swift +++ b/Packages/Pachyderm/Sources/Pachyderm/Model/Account.swift @@ -40,8 +40,9 @@ public final class Account: AccountProtocol, Decodable, Sendable { self.displayName = try container.decode(String.self, forKey: .displayName) self.locked = try container.decode(Bool.self, forKey: .locked) self.createdAt = try container.decode(Date.self, forKey: .createdAt) - self.followersCount = try container.decode(Int.self, forKey: .followersCount) - self.followingCount = try container.decode(Int.self, forKey: .followingCount) + // some instance types (pixelfed, firefish) seem to sometimes send null for these fields, so just fallback to 0 + self.followersCount = try container.decodeIfPresent(Int.self, forKey: .followersCount) ?? 0 + self.followingCount = try container.decodeIfPresent(Int.self, forKey: .followingCount) ?? 0 self.statusesCount = try container.decode(Int.self, forKey: .statusesCount) self.note = try container.decode(String.self, forKey: .note) self.url = try container.decode(URL.self, forKey: .url)