Avoid force-unwrapping — fix a crash. Fixes #5128.

This commit is contained in:
Brent Simmons committed 2026-02-18 21:56:51 -08:00
1 parent a75d67a43a
commit bc99867c22
1 file changed
+10 -4
@@ -407,15 +407,21 @@ enum CreateReaderAPISubscriptionResult {
request.httpMethod = "POST"
// Get ids from above into hex representation of value
let idsToFetch = articleIDs.map({ articleID -> String in
let idsToFetch = articleIDs.compactMap({ articleID -> String? in
if self.variant == .theOldReader {
return "i=tag:google.com,2005:reader/item/\(articleID)"
} else {
let idValue = Int(articleID)!
let idHexString = String(idValue, radix: 16, uppercase: false)
return "i=tag:google.com,2005:reader/item/\(idHexString)"
if let idValue = Int(articleID) {
let idHexString = String(idValue, radix: 16, uppercase: false)
return "i=tag:google.com,2005:reader/item/\(idHexString)"
} else {
return nil
}
}
}).joined(separator: "&")
if idsToFetch.isEmpty {
return nil
}
let postData = Data("T=\(token)&output=json&\(idsToFetch)".utf8)