Skip to content

Commit

Permalink
Don't force unwrap.
Browse files Browse the repository at this point in the history
  • Loading branch information
JPKribs committed Mar 3, 2025
1 parent 034bb73 commit efa0a8b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ struct SeriesEpisodeSelector: View {

// MARK: - Calculated Variables

private var selectionViewModel: SeasonItemViewModel {
viewModel.seasons.first(where: { $0.id == selection })!
private var selectionViewModel: SeasonItemViewModel? {
viewModel.seasons.first(where: { $0.id == selection })
}

// MARK: - Body
Expand All @@ -45,8 +45,10 @@ struct SeriesEpisodeSelector: View {
SeasonsHStack(viewModel: viewModel, selection: $selection)
.environmentObject(parentFocusGuide)

EpisodeHStack(viewModel: selectionViewModel, playButtonItem: viewModel.playButtonItem)
.environmentObject(parentFocusGuide)
if let selectionViewModel {
EpisodeHStack(viewModel: selectionViewModel, playButtonItem: viewModel.playButtonItem)
.environmentObject(parentFocusGuide)
}
}
.onReceive(viewModel.playButtonItem.publisher) { newValue in

Expand Down

0 comments on commit efa0a8b

Please sign in to comment.