Skip to content

Commit

Permalink
Fixes crash introduced in previous commit 9cf94d5.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Oct 12, 2018
1 parent 9cf94d5 commit ede3a3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions imgui_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2648,9 +2648,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
if (y + line_height < clip_rect.y && !word_wrap_enabled)
while (y + line_height < clip_rect.y && s < text_end)
{
s = (const char*)memchr(s, '\n', text_end - s) + 1;
if (s == NULL)
s = text_end;
s = (const char*)memchr(s, '\n', text_end - s);
s = s ? s + 1 : text_end;
y += line_height;
}

Expand All @@ -2662,7 +2661,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
float y_end = y;
while (y_end < clip_rect.w && s_end < text_end)
{
s_end = (const char*)memchr(s_end, '\n', text_end - s_end) + 1;
s_end = (const char*)memchr(s_end, '\n', text_end - s_end);
s = s ? s + 1 : text_end;
y_end += line_height;
}
text_end = s_end;
Expand Down
3 changes: 2 additions & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,8 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
break;
if (rect_pos.y < clip_rect.y)
{
p = (const ImWchar*)wmemchr((const wchar_t*)p, '\n', text_selected_end - p) + 1;
p = (const ImWchar*)wmemchr((const wchar_t*)p, '\n', text_selected_end - p);
p = p ? p + 1 : text_selected_end;
}
else
{
Expand Down

0 comments on commit ede3a3b

Please sign in to comment.