fix UB in mem edit
This commit is contained in:
parent
ca9b536a54
commit
bf3fe17393
1 changed files with 5 additions and 1 deletions
6
third_party/imgui_club/imgui_memory_editor.h
vendored
6
third_party/imgui_club/imgui_memory_editor.h
vendored
|
@ -436,7 +436,11 @@ struct MemoryEditor
|
|||
ImGui::SameLine(s.PosAsciiStart);
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
addr = (size_t)line_i * Cols;
|
||||
size_t mouseAddr = addr + (size_t)((ImGui::GetIO().MousePos.x - pos.x) / s.GlyphWidth);
|
||||
float mposx = ImGui::GetIO().MousePos.x;
|
||||
float posdiff = mposx - pos.x;
|
||||
if (posdiff < 0)
|
||||
posdiff = 0;
|
||||
size_t mouseAddr = addr + (size_t)(posdiff / s.GlyphWidth);
|
||||
ImGui::PushID(line_i);
|
||||
if (ImGui::InvisibleButton("ascii", ImVec2(s.PosAsciiEnd - s.PosAsciiStart, s.LineHeight)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue