BUGFIX: crashed when menu entry wider than 19 chars

This commit is contained in:
Robin Dietzel 2023-01-10 16:04:28 +01:00
parent 4ba4908f01
commit 74eceacf7e
2 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,7 @@ namespace floatpump::menu {
list.reserve(m_submenus.size() + m_entries.size());
//Append al Submenus
//Append all Submenus
for (auto &m_submenu: m_submenus) {
list.push_back(m_submenu->printLine());
}

View File

@ -11,6 +11,7 @@ namespace floatpump {
//We have 19 characters width for displaying the entry -> fill with spaces
int spaces = 19 - (m_name.length() + m_type.toString().length());
std::string spacer;
if(spaces > 0)
spacer.append(spaces, ' ');
return m_name + spacer + m_type.toString();
}