Prevent infinite recursion

pull/2282/head
Alex Baker 1 year ago
parent c303ce32ab
commit 19b2551f54

@ -148,7 +148,10 @@ class SectionedDataSource constructor(
sections.append(new.sectionedPosition, new) sections.append(new.sectionedPosition, new)
} }
tailrec fun getNearestHeader(sectionedPosition: Int): Long = if (isHeader(sectionedPosition)) { tailrec fun getNearestHeader(sectionedPosition: Int): Long =
if (sectionedPosition < 0) {
-1
} else if (isHeader(sectionedPosition)) {
getHeaderValue(sectionedPosition) getHeaderValue(sectionedPosition)
} else { } else {
getNearestHeader(sectionedPosition - 1) getNearestHeader(sectionedPosition - 1)

Loading…
Cancel
Save