Skip to content

Commit adf273c

Browse files
committed
reduce lookups
1 parent 5b7393a commit adf273c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libprojectM/projectM.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,15 @@ void projectM::populatePresetMenu()
791791
if(isTextInputActive()) {
792792
// if a searchTerm is active, we will populate the preset menu with search terms instead of the page we are on.
793793
int h = 0;
794+
std::string presetName = renderer->presetName();
795+
int presetIndex = getSearchIndex(presetName);
794796
for(unsigned int i = 0; i < getPlaylistSize(); i++) { // loop over all presets
795797
if (getPresetName(i).find(renderer->searchText()) != std::string::npos) { // if term matches
796798
if (h < renderer->textMenuPageSize) // limit to just one page, pagination is not needed.
797799
{
798800
h++;
799801
renderer->m_presetList.push_back({ h, getPresetName(i), "" }); // populate the renders preset list.
800-
if (h == getSearchIndex(renderer->presetName()))
802+
if (h == presetIndex)
801803
{
802804
renderer->m_activePresetID = h;
803805
}

0 commit comments

Comments
 (0)