1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

DrawList: Allow AddText() to accept null ranges. (#3615, 7391)

This commit is contained in:
ocornut 2024-03-27 10:50:55 +09:00
parent 5c5ae806aa
commit 37b37fc2a3
5 changed files with 10 additions and 8 deletions

View file

@ -1613,10 +1613,11 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos,
if ((col & IM_COL32_A_MASK) == 0)
return;
// Accept null ranges
if (text_begin == text_end || text_begin[0] == 0)
return;
if (text_end == NULL)
text_end = text_begin + strlen(text_begin);
if (text_begin == text_end)
return;
// Pull default font/size from the shared ImDrawListSharedData instance
if (font == NULL)