diff --git a/source/Modes/SongSelect.cpp b/source/Modes/SongSelect.cpp index 8924f59..67ef5c6 100644 --- a/source/Modes/SongSelect.cpp +++ b/source/Modes/SongSelect.cpp @@ -321,7 +321,14 @@ void SongSelect::UpdateSonglist(bool initial) OOUInt beatmap_list_offset = mCurrentPage * mEntriesPerPage; OOUInt entries_on_page = mEntriesPerPage; - if (beatmap_list_offset + (entries_on_page-1) >= mSongListSize) { + + if (entries_on_page >= mSongListSize) { + entries_on_page = mSongListSize; + beatmap_list_offset = 0; + mCurrentPage = 0; + } + + if (entries_on_page != 0 && (beatmap_list_offset + (entries_on_page-1) >= mSongListSize)) { entries_on_page = mSongListSize - beatmap_list_offset; } diff --git a/source/Modes/SongSelect.h b/source/Modes/SongSelect.h index 42220c2..7cc2d8c 100644 --- a/source/Modes/SongSelect.h +++ b/source/Modes/SongSelect.h @@ -26,6 +26,7 @@ class SongSelect : public Mode static void PageNext() { AudioManager::Engine().PlayUISound(UISOUND_CLICK_SHORT_CONFIRM); + if (mCountPages == 0) { return; } if (mCurrentPage < (mCountPages - 1)) { PreviewBuffer::GetInstance().Update((OOInt)mCurrentPage, (mCurrentPage+1), mEntriesPerPage); mCurrentPage++; @@ -35,6 +36,7 @@ class SongSelect : public Mode }; static void PagePrev() { AudioManager::Engine().PlayUISound(UISOUND_CLICK_SHORT_CONFIRM); + if (mCountPages == 0) { return; } if (mCurrentPage > 0) { PreviewBuffer::GetInstance().Update((OOInt)mCurrentPage, (mCurrentPage-1), mEntriesPerPage); mCurrentPage--; @@ -44,6 +46,8 @@ class SongSelect : public Mode }; static void PageRand() { AudioManager::Engine().PlayUISound(UISOUND_CLICK_SHORT_CONFIRM); + if (mCountPages == 0) { return; } + if (mCountPages <= 1) { shouldExpandRandomEntry = true; return;