TextUnformatted: Accept null ranges including (NULL,NULL) without asserting. (#3615)

This commit is contained in:
ocornut
2021-08-24 19:30:02 +02:00
parent 2b0bd40b99
commit 780c1ee265
3 changed files with 9 additions and 3 deletions

View File

@ -152,9 +152,13 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
return;
ImGuiContext& g = *GImGui;
IM_ASSERT(text != NULL);
// Accept null ranges
if (text == text_end)
text = text_end = "";
// Calculate length
const char* text_begin = text;
if (text_end == NULL)
text_end = text + strlen(text); // FIXME-OPT