Skip to content

Commit

Permalink
Handle null categories in generate maze quiz worker
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomanaia committed Dec 28, 2024
1 parent 544fe55 commit b5085ea
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ class GenerateMazeQuizWorker @AssistedInject constructor(
}

val comparisonQuizCategories = comparisonQuizRepository.getCategories()
val comparisonMazeQuestions = comparisonQuizCategoriesIds.map { categoryId ->
val comparisonMazeQuestions = comparisonQuizCategoriesIds.mapNotNull { categoryId ->
val category = comparisonQuizCategories.find { it.id == categoryId }
// TODO: Handle if category is removed/dont exist
requireNotNull(category)
if (category == null) return@mapNotNull null

generateComparisonMazeItems(
category = category,
Expand Down

0 comments on commit b5085ea

Please sign in to comment.