1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-06-29 00:14:13 +03:00

Make sure inserting a new section doesn't change the selected section

This commit is contained in:
Maarten ter Huurne 2015-04-26 20:25:08 +02:00
parent 49bbf3a4f6
commit b6fcf0f69d

View File

@ -472,6 +472,10 @@ int Menu::sectionNamed(const char *sectionName)
if (it == sections.end() || *it != sectionName) {
sections.emplace(it, sectionName);
links.emplace(links.begin() + idx);
// Make sure the selected section doesn't change.
if (idx <= iSection) {
iSection++;
}
}
return idx;
}