Skip to content

Commit

Permalink
Fix crash when event has multiple webcasts (#852)
Browse files Browse the repository at this point in the history
[app_store]
  • Loading branch information
ZachOrr authored Feb 22, 2020
2 parents a4057a2 + 367b314 commit 84f4584
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ private enum EventInfoSection: Int {
case link
}

private enum EventInfoItem {
private enum EventInfoItem: Hashable {
case title
case alliances
case districtPoints
case stats
case awards
case webcast
case webcast(Webcast)
case website
case twitter
case youtube
Expand Down Expand Up @@ -147,7 +147,7 @@ class EventInfoViewController: TBATableViewController, Observable {
snapshot.appendItems(detailItems, toSection: .detail)

// Webcasts
let webcasts = event.webcasts.compactMap { $0.urlString }.map { _ in EventInfoItem.webcast }
let webcasts = event.webcasts.map { EventInfoItem.webcast($0) }
if !webcasts.isEmpty, event.isHappeningThisWeek {
snapshot.appendSections([.webcast])
snapshot.appendItems(webcasts, toSection: .webcast)
Expand Down Expand Up @@ -201,8 +201,7 @@ class EventInfoViewController: TBATableViewController, Observable {
delegate?.showStats()
case .awards:
delegate?.showAwards()
case .webcast:
let webcast = event.webcasts[indexPath.row]
case .webcast(let webcast):
urlString = webcast.urlString
case .website:
urlString = event.website
Expand Down

0 comments on commit 84f4584

Please sign in to comment.