fix: Potential infinite loop while wrapping text

This commit is contained in:
WerWolv 2025-12-01 22:57:49 +01:00
parent 46fdbd5bc0
commit 0e5136196a
1 changed files with 3 additions and 0 deletions

View File

@ -1063,6 +1063,9 @@ namespace ImGuiExt {
auto textEnd = text + strlen(text);
for (auto wrapPos = text; wrapPos != textEnd;) {
wrapPos = ImGui::GetFont()->CalcWordWrapPosition(GetFontSize(), wrapPos, textEnd, availableSpace.x * 0.8F);
if (text == wrapPos)
break;
drawString += std::string(text, wrapPos) + "\n";
text = wrapPos;
}