From 504bc5cc6719db3bcafa5f1262b95fa2a58ec0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 5 Apr 2021 08:52:21 +0200 Subject: [PATCH] Fix crashes in *_input functions --- editor/animation_bezier_editor.cpp | 2 ++ editor/animation_track_editor.cpp | 4 ++++ editor/animation_track_editor_plugins.cpp | 2 ++ editor/code_editor.cpp | 4 ++++ editor/editor_audio_buses.cpp | 2 ++ editor/editor_file_dialog.cpp | 2 ++ editor/editor_help.cpp | 2 ++ editor/editor_inspector.cpp | 4 ++++ editor/editor_node.cpp | 2 ++ editor/editor_spin_slider.cpp | 2 ++ editor/plugins/animation_player_editor_plugin.cpp | 2 ++ editor/plugins/asset_library_editor_plugin.cpp | 2 ++ editor/plugins/canvas_item_editor_plugin.cpp | 2 ++ editor/plugins/mesh_editor_plugin.cpp | 2 ++ editor/plugins/node_3d_editor_plugin.cpp | 6 ++++++ editor/plugins/script_editor_plugin.cpp | 2 ++ editor/plugins/texture_layered_editor_plugin.cpp | 2 ++ editor/project_manager.cpp | 2 ++ editor/scene_tree_dock.cpp | 4 ++++ editor/settings_config_dialog.cpp | 2 ++ modules/visual_script/visual_script_editor.cpp | 2 ++ scene/2d/touch_screen_button.cpp | 2 ++ scene/gui/base_button.cpp | 4 ++++ scene/gui/file_dialog.cpp | 2 ++ scene/gui/gradient_edit.cpp | 2 ++ scene/gui/graph_edit.cpp | 4 ++++ scene/gui/graph_node.cpp | 2 ++ scene/gui/item_list.cpp | 2 ++ scene/gui/line_edit.cpp | 2 ++ scene/gui/menu_button.cpp | 2 ++ scene/gui/popup_menu.cpp | 2 ++ scene/gui/rich_text_label.cpp | 2 ++ scene/gui/scroll_bar.cpp | 2 ++ scene/gui/scroll_container.cpp | 2 ++ scene/gui/slider.cpp | 2 ++ scene/gui/spin_box.cpp | 2 ++ scene/gui/split_container.cpp | 2 ++ scene/gui/subviewport_container.cpp | 4 ++++ scene/gui/tab_container.cpp | 2 ++ scene/gui/tabs.cpp | 2 ++ scene/gui/text_edit.cpp | 2 ++ scene/gui/tree.cpp | 2 ++ scene/main/viewport.cpp | 1 + 43 files changed, 103 insertions(+) diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 92b46830189..ab8ae719047 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -602,6 +602,8 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref &p_anim, int } void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_pressed()) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { duplicate_selection(); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 4274fb993ff..4fe2d2bb2a1 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1641,6 +1641,8 @@ void AnimationTimelineEdit::_play_position_draw() { } void AnimationTimelineEdit::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) { @@ -2522,6 +2524,8 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const { } void AnimationTrackEdit::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_pressed()) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { emit_signal("duplicate_request"); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 1028d34fb23..506a327ffc5 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -1036,6 +1036,8 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant } void AnimationTrackEditTypeAudio::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mm = p_event; if (!len_resizing && mm.is_valid()) { bool use_hsize_cursor = false; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 11be365f0ac..ac8bef817b4 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 &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref 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 &event) { + ERR_FAIL_COND(event.is_null()); + const Ref key_event = event; if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { return; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 3a5ebe8e851..e7934bed0a3 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -531,6 +531,8 @@ void EditorAudioBus::_effect_add(int p_which) { } void EditorAudioBus::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index f78da9569fb..75815fa7507 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -125,6 +125,8 @@ void EditorFileDialog::_notification(int p_what) { } void EditorFileDialog::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; if (k.is_valid()) { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 283713cd3c7..a747652a2f6 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1908,6 +1908,8 @@ void FindBar::_hide_bar() { } void FindBar::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; if (k.is_valid()) { if (k->is_pressed() && (rich_text_label->has_focus() || is_a_parent_of(get_focus_owner()))) { diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 70d1a514b5c..236e0f1abbc 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -682,6 +682,8 @@ bool EditorProperty::is_selected() const { } void EditorProperty::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (property == StringName()) { return; } @@ -1354,6 +1356,8 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe } void EditorInspectorSection::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!foldable) { return; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 21f1d053048..cc9080c923d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -390,6 +390,8 @@ void EditorNode::_update_title() { } void EditorNode::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; if (k.is_valid() && k->is_pressed() && !k->is_echo()) { EditorPlugin *old_editor = editor_plugin_screen; diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index c09d78826ca..8577ccb9db8 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -47,6 +47,8 @@ String EditorSpinSlider::get_text_value() const { } void EditorSpinSlider::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (read_only) { return; } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 03481dfb38f..612a8f30a48 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1219,6 +1219,8 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { } void AnimationPlayerEditor::_unhandled_key_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref k = p_ev; if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) { switch (k->get_keycode()) { diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 1345adc8ee6..9f29641692b 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -606,6 +606,8 @@ void EditorAssetLibrary::_update_repository_options() { } void EditorAssetLibrary::_unhandled_key_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref key = p_event; if (key.is_valid() && key->is_pressed()) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d4e06aa9caf..b678197037a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -472,6 +472,8 @@ float CanvasItemEditor::snap_angle(float p_target, float p_start) const { } void CanvasItemEditor::_unhandled_key_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref k = p_ev; if (!is_visible_in_tree()) { diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 77719104b13..9d29c315223 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -33,6 +33,8 @@ #include "editor/editor_scale.h" void MeshEditor::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mm = p_event; if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { rot_x -= mm->get_relative().y * 0.01; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 81c59fc0a93..0ab5d216185 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -185,6 +185,8 @@ void ViewportRotationControl::_get_sorted_axis(Vector &r_axis) { } void ViewportRotationControl::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 pos = mb->get_position(); @@ -4192,6 +4194,8 @@ Node3DEditorViewport::~Node3DEditorViewport() { ////////////////////////////////////////////////////////////// void Node3DEditorViewportContainer::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { @@ -6159,6 +6163,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() { } void Node3DEditor::_unhandled_key_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_visible_in_tree()) { return; } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b2984744068..58e6717a3d9 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2706,6 +2706,8 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co } void ScriptEditor::_unhandled_key_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) { return; } diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 265d4ccc1e6..89ed98d53e6 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -35,6 +35,8 @@ #include "editor/editor_settings.h" void TextureLayeredEditor::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mm = p_event; if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { y_rot += -mm->get_relative().x * 0.01; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index eda9499783a..58f48571b19 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1882,6 +1882,8 @@ void ProjectManager::_update_project_buttons() { } void ProjectManager::_unhandled_key_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref k = p_ev; if (k.is_valid()) { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 57d517b7e9d..c62e9cbe5fd 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -61,6 +61,8 @@ void SceneTreeDock::_quick_open() { } void SceneTreeDock::_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mb = p_event; if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { @@ -69,6 +71,8 @@ void SceneTreeDock::_input(Ref p_event) { } void SceneTreeDock::_unhandled_key_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (get_focus_owner() && get_focus_owner()->is_text_field()) { return; } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 3852c389c7f..3be2136a20f 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -139,6 +139,8 @@ void EditorSettingsDialog::_notification(int p_what) { } void EditorSettingsDialog::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref k = p_event; if (k.is_valid() && k->is_pressed()) { diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index d520837d43b..4cc238e69a3 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1826,6 +1826,8 @@ void VisualScriptEditor::_generic_search(String p_base_type, Vector2 pos, bool n } void VisualScriptEditor::_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + // GUI input for VS Editor Plugin Ref key = p_event; diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 9d6868a1b26..4e58984b376 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -189,6 +189,8 @@ String TouchScreenButton::get_action() const { } void TouchScreenButton::_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!get_tree()) { return; } diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index db13b9b11f5..826fd0189bc 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -53,6 +53,8 @@ void BaseButton::_unpress_group() { } void BaseButton::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (status.disabled) { // no interaction with disabled button return; } @@ -323,6 +325,8 @@ Ref BaseButton::get_shortcut() const { } void BaseButton::_unhandled_key_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!_is_focus_owner_in_shorcut_context()) { return; } diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 7ac8dbccca9..5409b44b9e1 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -96,6 +96,8 @@ void FileDialog::_notification(int p_what) { } void FileDialog::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; if (k.is_valid() && has_focus()) { if (k->is_pressed()) { diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 36b383f16c3..e72709e847a 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -92,6 +92,8 @@ GradientEdit::~GradientEdit() { } void GradientEdit::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b93391ee4c1..65046d5d100 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -154,6 +154,8 @@ Vector2 GraphEditMinimap::_convert_to_graph_position(const Vector2 &p_position) } void GraphEditMinimap::_gui_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + if (!ge->is_minimap_enabled()) { return; } @@ -1066,6 +1068,8 @@ void GraphEdit::set_selected(Node *p_child) { } void GraphEdit::_gui_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref mm = p_ev; if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 8eba473d57f..7d5c53effe4 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -804,6 +804,8 @@ Color GraphNode::get_connection_output_color(int p_idx) { } void GraphNode::_gui_input(const Ref &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref mb = p_ev; if (mb.is_valid()) { ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node."); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 482560d29d0..86d070f9b1b 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -530,6 +530,8 @@ Size2 ItemList::Item::get_icon_size() const { } void ItemList::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + double prev_scroll = scroll_bar->get_value(); Ref mm = p_event; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index d1cd73c803e..2d8eb3191c9 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -215,6 +215,8 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) { } void LineEdit::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref b = p_event; if (b.is_valid()) { diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 5acc7e808a2..1e9baa77fc4 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -34,6 +34,8 @@ #include "scene/main/window.h" void MenuButton::_unhandled_key_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!_is_focus_owner_in_shorcut_context()) { return; } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index bfbd46a9f0e..44df8eafdc9 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -252,6 +252,8 @@ void PopupMenu::_submenu_timeout() { } void PopupMenu::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_action("ui_down") && p_event->is_pressed()) { int search_from = mouse_over + 1; if (search_from >= items.size()) { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 09f65782951..c763ae6bd60 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1469,6 +1469,8 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const } void RichTextLabel::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref b = p_event; if (b.is_valid()) { diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index a56bf15507a..62276e3af0c 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -42,6 +42,8 @@ void ScrollBar::set_can_focus_by_default(bool p_can_focus) { } void ScrollBar::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref m = p_event; if (!m.is_valid() || drag.active) { emit_signal("scrolling"); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 90a528482f8..757a0841eaa 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -88,6 +88,8 @@ void ScrollContainer::_cancel_drag() { } void ScrollContainer::_gui_input(const Ref &p_gui_input) { + ERR_FAIL_COND(p_gui_input.is_null()); + double prev_v_scroll = v_scroll->get_value(); double prev_h_scroll = h_scroll->get_value(); diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 7f1d19a87ae..a407ef21cbc 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -46,6 +46,8 @@ Size2 Slider::get_minimum_size() const { } void Slider::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!editable) { return; } diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 50b25fa7b42..9dc2afdb2dc 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -100,6 +100,8 @@ void SpinBox::_release_mouse() { } void SpinBox::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_editable()) { return; } diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index c80120f87d9..13ff2c5b869 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -207,6 +207,8 @@ void SplitContainer::_notification(int p_what) { } void SplitContainer::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) { return; } diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index 8ffdd269a4f..bfc7e29f9cf 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -140,6 +140,8 @@ void SubViewportContainer::_notification(int p_what) { } void SubViewportContainer::_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (Engine::get_singleton()->is_editor_hint()) { return; } @@ -165,6 +167,8 @@ void SubViewportContainer::_input(const Ref &p_event) { } void SubViewportContainer::_unhandled_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (Engine::get_singleton()->is_editor_hint()) { return; } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 1e31f9e2060..ff9dafa0f9c 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -72,6 +72,8 @@ int TabContainer::_get_top_margin() const { } void TabContainer::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mb = p_event; Popup *popup = get_popup(); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 38a5588b7ef..6cbc5890ce6 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -91,6 +91,8 @@ Size2 Tabs::get_minimum_size() const { } void Tabs::_gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref mm = p_event; if (mm.is_valid()) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 74c530f1b00..f54ab004c6c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2854,6 +2854,8 @@ void TextEdit::_get_minimap_mouse_row(const Point2i &p_mouse, int &r_row) const } void TextEdit::_gui_input(const Ref &p_gui_input) { + ERR_FAIL_COND(p_gui_input.is_null()); + double prev_v_scroll = v_scroll->get_value(); double prev_h_scroll = h_scroll->get_value(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index abfea241f34..73fd9dbcd73 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2402,6 +2402,8 @@ void Tree::_go_down() { } void Tree::_gui_input(Ref p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref k = p_event; bool is_command = k.is_valid() && k->get_command(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5df35d1e6a2..f382f5b685c 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3067,6 +3067,7 @@ void Viewport::input(const Ref &p_event, bool p_local_coords) { } void Viewport::unhandled_input(const Ref &p_event, bool p_local_coords) { + ERR_FAIL_COND(p_event.is_null()); ERR_FAIL_COND(!is_inside_tree()); if (disable_input || !_can_consume_input_events()) {