From 4f3734532475b9d718566e114df312f95a08f0dd Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 6 Aug 2022 17:47:11 +0200 Subject: [PATCH] fix: Crash when exiting hex editor editing mode Fixes #658 --- .../builtin/source/content/views/view_hex_editor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index ede9cda5f..4ede0746e 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -533,11 +533,6 @@ namespace hex::plugin::builtin { ImGui::SetKeyboardFocusHere(); ImGui::SetNextFrameWantCaptureKeyboard(true); - if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) { - this->m_editingAddress = std::nullopt; - this->m_shouldModifyValue = false; - } - if (this->m_currDataVisualizer->drawEditing(*this->m_editingAddress, this->m_editingBytes.data(), this->m_editingBytes.size(), this->m_upperCaseHex, this->m_enteredEditingMode) || this->m_shouldModifyValue) { provider->write(*this->m_editingAddress, this->m_editingBytes.data(), this->m_editingBytes.size()); @@ -558,6 +553,11 @@ namespace hex::plugin::builtin { this->m_shouldUpdateEditingValue = true; } + if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !hovered) { + this->m_editingAddress = std::nullopt; + this->m_shouldModifyValue = false; + } + this->m_enteredEditingMode = false; } }