fix notification manager error when only one line : supermerill/SuperSlicer#1128

This commit is contained in:
supermerill 2021-05-27 14:44:26 +02:00
parent 6d2deda47a
commit bf520b8bdb

View File

@ -515,7 +515,9 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons
ImGui::SetCursorPosY(win_size.y / 2 - win_size.y / 6 - m_line_height / 2);
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
// line2
std::string line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
std::string line = "";
if (m_text1.size() > m_endlines[0])
std::string line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
cursor_y = win_size.y / 2 + win_size.y / 6 - m_line_height / 2;
ImGui::SetCursorPosX(x_offset);
ImGui::SetCursorPosY(cursor_y);