diff options
| author | kobewi <kobewi4e@gmail.com> | 2024-10-24 17:05:05 +0200 |
|---|---|---|
| committer | kobewi <kobewi4e@gmail.com> | 2024-10-24 17:05:05 +0200 |
| commit | abb9c0f171c7150a510ca2c2a744534f1746635d (patch) | |
| tree | 7552a1a92f19009d02ede6e5fc38aed66eb5589d | |
| parent | ff9fb0abea2027c35f0a024297c780648cc806bc (diff) | |
| download | redot-engine-abb9c0f171c7150a510ca2c2a744534f1746635d.tar.gz | |
Fix InputEvent crash when opening project
| -rw-r--r-- | core/config/project_settings.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 52677e80c3..b389e5a58e 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -515,9 +515,9 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) { Dictionary action = E.value.variant; Array events = action["events"]; for (int i = 0; i < events.size(); i++) { - Ref<InputEvent> x = events[i]; - if (x->get_device() == -1) { // -1 was the previous value (GH-97707). - x->set_device(InputEvent::DEVICE_ID_ALL_DEVICES); + Ref<InputEvent> ev = events[i]; + if (ev.is_valid() && ev->get_device() == -1) { // -1 was the previous value (GH-97707). + ev->set_device(InputEvent::DEVICE_ID_ALL_DEVICES); } } } |
