marstran
07/30/2018, 12:41 PMcategories != null. The compiler cannot infer that it's not null from the .orEmpty().isEmpty() call.mp
07/30/2018, 12:42 PMmp
07/30/2018, 12:48 PMmarstran
07/30/2018, 1:06 PMorEmpty call with the with function. The receiver inside with is non-null.marstran
07/30/2018, 1:08 PMcategories.orEmpty(). You could do this to fix it:
val nonNullCategories = categories.orEmpty()
if (nonNullCategories.isEmpty()) {
0
} else {
nonNullCategories.map {
...
}
}