Skip to content

Commit 5f3179f

Browse files
authored
Update ArticlesScreen.kt
1 parent bfdd398 commit 5f3179f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎source-code/app/src/main/java/com/hackeros/app/ui/screens/ArticlesScreen.kt‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ fun ArticlesScreen(
7979

8080
BackHandler(enabled = open != null) { onCloseArticle() }
8181

82-
if (open != null && data != null) {
83-
ArticleReader(open, data, lang, theme, translations, onCloseArticle)
82+
// `open` can only be non-null when `data` is (it's looked up from data.articles), but the
83+
// compiler can't see that through the elvis/firstOrNull chain, hence the explicit `!!`
84+
// instead of a redundant `data != null` check.
85+
if (open != null) {
86+
ArticleReader(open, data!!, lang, theme, translations, onCloseArticle)
8487
} else {
8588
ArticleList(data, loading, error, fromCache, lang, theme, translations, onOpenArticle, onRetry)
8689
}

0 commit comments

Comments
 (0)