Make sure that article.preferredLink doesn’t return an empty string.

This commit is contained in:
Brent Simmons 2019-09-07 18:27:48 -07:00
parent 60f13c32a4
commit 5b15285e8e
1 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,13 @@ extension Article {
}
var preferredLink: String? {
return url ?? externalURL
if let url = url, !url.isEmpty {
return url
}
if let externalURL = externalURL, !externalURL.isEmpty {
return externalURL
}
return nil
}
var body: String? {