Skip to content

Commit 27e13fa

Browse files
authored
Merge pull request #425 from pennlabs/native-news-hotfix
Allow for empty captions/authors
2 parents 7c923fd + f1721c9 commit 27e13fa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

PennMobile/Home/Cells/News/NativeNewsViewController.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ class NativeNewsViewController: UIViewController {
7878
for author in article.data.labsArticle.authors {
7979
authorLabel.text! += author.name + ", "
8080
}
81-
authorLabel.text?.removeLast(2)
81+
if authorLabel.text != "" {
82+
authorLabel.text?.removeLast(2)
83+
}
8284
authorLabel.text! += " | " + article.data.labsArticle.published_at
8385
authorLabel.lineBreakMode = .byWordWrapping
8486
authorLabel.numberOfLines = 0
@@ -103,7 +105,9 @@ class NativeNewsViewController: UIViewController {
103105
for author in article.data.labsArticle.dominantMedia.authors {
104106
imageCaptionView.text! += author.name + ", "
105107
}
106-
imageCaptionView.text?.removeLast(2)
108+
if imageCaptionView.text != "" {
109+
imageCaptionView.text?.removeLast(2)
110+
}
107111
imageCaptionView.lineBreakMode = .byWordWrapping
108112
imageCaptionView.numberOfLines = 0
109113
imageCaptionView.font = UIFont.preferredFont(forTextStyle: .caption1, compatibleWith: .current)

0 commit comments

Comments
 (0)