ui/menu.h: Refactor probably-unsafe code referencing temporary object

This commit is contained in:
AJR 2023-11-14 18:33:58 -05:00
parent a1962fb222
commit 816e975d25

View File

@ -278,11 +278,11 @@ protected:
float maxwidth(origwidth);
for (Iter it = begin; it != end; ++it)
{
std::string_view const &line(*it);
std::string_view const line(*it);
if (!line.empty())
{
text_layout layout(*ui().get_font(), text_size * m_last_aspect, text_size, 1.0, justify, wrap);
layout.add_text(std::string_view(*it), rgb_t::white(), rgb_t::black());
layout.add_text(line, rgb_t::white(), rgb_t::black());
maxwidth = (std::max)(layout.actual_width(), maxwidth);
}
}