Browse Source

Merge pull request #65830 from EricEzaM/fix-shortcut-crash

Check TreeItem for nullptr before accessing.
Rémi Verschelde 2 years ago
parent
commit
76b41bde3c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      editor/editor_settings_dialog.cpp

+ 4 - 0
editor/editor_settings_dialog.cpp

@@ -552,6 +552,10 @@ void EditorSettingsDialog::_shortcut_cell_double_clicked() {
 	const ShortcutButton edit_btn_id = EditorSettingsDialog::SHORTCUT_EDIT;
 	const ShortcutButton edit_btn_id = EditorSettingsDialog::SHORTCUT_EDIT;
 	const int edit_btn_col = 1;
 	const int edit_btn_col = 1;
 	TreeItem *ti = shortcuts->get_selected();
 	TreeItem *ti = shortcuts->get_selected();
+	if (ti == nullptr) {
+		return;
+	}
+
 	String type = ti->get_meta("type");
 	String type = ti->get_meta("type");
 	int col = shortcuts->get_selected_column();
 	int col = shortcuts->get_selected_column();
 	if (type == "shortcut" && col == 0) {
 	if (type == "shortcut" && col == 0) {