summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorRafał Mikrut <mikrutrafal@protonmail.com>2021-04-05 08:52:21 +0200
committerRafał Mikrut <mikrutrafal@protonmail.com>2021-04-05 08:52:21 +0200
commit504bc5cc6719db3bcafa5f1262b95fa2a58ec0a1 (patch)
tree4dc94056680fd757e2b99197c2c3518990755202 /editor/code_editor.cpp
parenta864a703ee27065795c6297aaeb72ed753d0f279 (diff)
Fix crashes in *_input functions
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 11be365f0a..ac8bef817b 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -109,6 +109,8 @@ void FindReplaceBar::_notification(int p_what) {
}
void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
Ref<InputEventKey> k = p_event;
if (!k.is_valid() || !k->is_pressed()) {
return;
@@ -691,6 +693,8 @@ FindReplaceBar::FindReplaceBar() {
// This function should be used to handle shortcuts that could otherwise
// be handled too late if they weren't handled here.
void CodeTextEditor::_input(const Ref<InputEvent> &event) {
+ ERR_FAIL_COND(event.is_null());
+
const Ref<InputEventKey> key_event = event;
if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) {
return;