Skip to content

Commit

Permalink
fixup! Fix ChatView TableView crash when scrolling to bottom
Browse files Browse the repository at this point in the history
This PR resolves a race condition that caused a crash when scrolling to the bottom.
The issue stemmed from outdated section row count data, leading the system to
believe a section had rows when, in actuality, it didn't.

MOB-2578
  • Loading branch information
rasmustautsglia committed Aug 25, 2023
1 parent e59b5a0 commit d036829
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GliaWidgets/Sources/Extensions/UITableView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ internal extension UITableView {
guard let self = self else { return }

// Identify the last section with at least one row.
let section = (0..<self.numberOfSections).reversed().first { self.numberOfRows(inSection: $0) > 0 }
let section = (0..<self.numberOfSections)
.reversed()
.first { self.numberOfRows(inSection: $0) > 0 }

guard let validSection = section else { return }
let rowCount = self.numberOfRows(inSection: validSection)
Expand Down

0 comments on commit d036829

Please sign in to comment.