From 0f70c9059e4b7f5d332b1a86228902e4348cb7d1 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 19 Nov 2023 22:52:58 -0500 Subject: [PATCH] Fix error decoding certain statuses on pixelfed --- Packages/Pachyderm/Sources/Pachyderm/Model/Status.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/Pachyderm/Sources/Pachyderm/Model/Status.swift b/Packages/Pachyderm/Sources/Pachyderm/Model/Status.swift index 3806dd22..1d59647a 100644 --- a/Packages/Pachyderm/Sources/Pachyderm/Model/Status.swift +++ b/Packages/Pachyderm/Sources/Pachyderm/Model/Status.swift @@ -66,7 +66,8 @@ public final class Status: StatusProtocol, Decodable, Sendable { self.inReplyToID = try container.decodeIfPresent(String.self, forKey: .inReplyToID) self.inReplyToAccountID = try container.decodeIfPresent(String.self, forKey: .inReplyToAccountID) self.reblog = try container.decodeIfPresent(Status.self, forKey: .reblog) - self.content = try container.decode(String.self, forKey: .content) + // pixelfed statuses may have null content + self.content = try container.decodeIfPresent(String.self, forKey: .content) ?? "" self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.emojis = try container.decodeIfPresent([Emoji].self, forKey: .emojis) ?? [] self.reblogsCount = try container.decode(Int.self, forKey: .reblogsCount)