[Input] Handle invalid input/ settings correctly

This prefix is reserved for events
This commit is contained in:
A Thousand Ships 2026-01-30 14:37:46 +01:00
parent f4f0679a2d
commit d3924468a4
No known key found for this signature in database
GPG key ID: 2613257BD9962224
2 changed files with 10 additions and 0 deletions

View file

@ -317,6 +317,11 @@ void InputMap::load_from_project_settings() {
String name = pi.name.substr(pi.name.find_char('/') + 1);
Dictionary action = GLOBAL_GET(pi.name);
if (!action.has("events")) {
continue;
}
float deadzone = action.has("deadzone") ? (float)action["deadzone"] : DEFAULT_DEADZONE;
Array events = action["events"];

View file

@ -613,6 +613,11 @@ void ProjectSettingsEditor::_update_action_map_editor() {
String display_name = property_name.substr(String("input/").size() - 1);
Dictionary action = GLOBAL_GET(property_name);
if (!action.has("events")) {
WARN_PRINT_ONCE_ED(vformat("Attempted to load invalid input action from setting at \"%s\". The `input/` prefix should only be used for input actions, and cannot be changed in the settings editor. Consider changing the category.", property_name));
continue;
}
ActionMapEditor::ActionInfo action_info;
action_info.action = action;
action_info.editable = true;