mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 08:17:16 +00:00
Avoid force-unwrapping — fix a crash. Fixes #5128.
This commit is contained in:
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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user