From 932ce93fd77d9e61b5ca85967960a50a948eae4e Mon Sep 17 00:00:00 2001 From: Federico Guerinoni Date: Sun, 16 Jan 2022 10:58:09 +0100 Subject: HexEditor: Fix crash of copy action when selection is empty Closes: #11925 --- Userland/Applications/HexEditor/HexEditor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/HexEditor/HexEditor.h b/Userland/Applications/HexEditor/HexEditor.h index 2ad80a8a4c..07834dee76 100644 --- a/Userland/Applications/HexEditor/HexEditor.h +++ b/Userland/Applications/HexEditor/HexEditor.h @@ -41,7 +41,7 @@ public: bool save(); void select_all(); - bool has_selection() const { return !((m_selection_end < m_selection_start) || m_document->size()); } + bool has_selection() const { return m_selection_start < m_selection_end && m_document->size() > 0; } size_t selection_size(); size_t selection_start_offset() const { return m_selection_start; } bool copy_selected_text_to_clipboard(); -- cgit v1.2.3