diff --git a/src/activities/reader/XtcReaderActivity.cpp b/src/activities/reader/XtcReaderActivity.cpp index d65bab38..b0cdfcc1 100644 --- a/src/activities/reader/XtcReaderActivity.cpp +++ b/src/activities/reader/XtcReaderActivity.cpp @@ -12,6 +12,8 @@ #include #include +#include + #include "CrossPointSettings.h" #include "CrossPointState.h" #include "MappedInputManager.h" @@ -462,12 +464,11 @@ void XtcReaderActivity::onButtonAction(const CrossPointSettings::BUTTON_ACTION a case BA::BTN_NEXT_SECTION: if (xtc->hasChapters()) { const auto& chapters = xtc->getChapters(); - for (const auto& ch : chapters) { - if (ch.startPage > currentPage) { - currentPage = ch.startPage; - requestUpdate(); - break; - } + const auto it = std::find_if(chapters.begin(), chapters.end(), + [this](const auto& ch) { return ch.startPage > currentPage; }); + if (it != chapters.end()) { + currentPage = it->startPage; + requestUpdate(); } } break;