From b2a6d2cea46f05af1f9772d60faec0cb9ef47df7 Mon Sep 17 00:00:00 2001 From: Rok Povsic Date: Sun, 27 Dec 2020 09:47:00 +0100 Subject: [PATCH] HexEditor: Don't update selection numbers when clicking the last+1 char Clicking at the cell after the last one, where there's no character, used to update the selection from/to numbers. Since there's no character there, that shouldn't happen. --- Applications/HexEditor/HexEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 693f3b708b..2eef357b15 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -217,7 +217,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event) auto byte_y = (absolute_y - hex_start_y) / line_height(); auto offset = (byte_y * m_bytes_per_row) + byte_x; - if (offset < 0 || offset > static_cast(m_buffer.size())) + if (offset < 0 || offset >= static_cast(m_buffer.size())) return; #ifdef HEX_DEBUG @@ -239,7 +239,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event) auto byte_y = (absolute_y - text_start_y) / line_height(); auto offset = (byte_y * m_bytes_per_row) + byte_x; - if (offset < 0 || offset > static_cast(m_buffer.size())) + if (offset < 0 || offset >= static_cast(m_buffer.size())) return; #ifdef HEX_DEBUG