summaryrefslogtreecommitdiff
path: root/src/ui/screen_track_browser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/screen_track_browser.cpp')
-rw-r--r--src/ui/screen_track_browser.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/ui/screen_track_browser.cpp b/src/ui/screen_track_browser.cpp
index 8f8321d7..86140558 100644
--- a/src/ui/screen_track_browser.cpp
+++ b/src/ui/screen_track_browser.cpp
@@ -307,18 +307,13 @@ auto TrackBrowser::GetRecordByIndex(std::size_t index)
}
ESP_LOGI(kTag, "total tracks %u, getting index %u", total_tracks, index);
- std::size_t current_index = 0;
for (const auto& page : current_pages_) {
- if (index > current_index + page->values().size()) {
- current_index += page->values().size();
- continue;
- }
- if (index < current_index) {
- // uhhh
- break;
+ for (int i = 0; i < page->values().size(); i++) {
+ if (index == 0) {
+ return page->values().at(i);
+ }
+ index--;
}
- std::size_t index_in_page = index - current_index;
- return page->values().at(index_in_page);
}
return {};
}