From 658fb0a0a9b27d93bfccc17f24e55726ec69b293 Mon Sep 17 00:00:00 2001 From: Bernhard Liebl Date: Sun, 10 Dec 2017 16:08:24 +0100 Subject: [PATCH] Fix crash in RichTextLabel::selection_copy() --- scene/gui/rich_text_label.cpp | 2 +- scene/gui/rich_text_label.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 9cf4c105b466..45188c3a5241 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1822,7 +1822,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection) { void RichTextLabel::selection_copy() { - if (!selection.enabled) + if (!selection.active || !selection.enabled) return; String text; diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 1096e3f6507d..b9a719dd10db 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -256,8 +256,8 @@ private: Item *to; int to_char; - bool active; - bool enabled; + bool active; // anything selected? i.e. from, to, etc. valid? + bool enabled; // allow selections? }; Selection selection;