diff options
Diffstat (limited to 'core/input_map.cpp')
-rw-r--r-- | core/input_map.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/input_map.cpp b/core/input_map.cpp index 04911787a8..2a8ac435fe 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -192,17 +192,14 @@ bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed, float *p_strength) const { Map<StringName, Action>::Element *E = input_map.find(p_action); - if (!E) { - ERR_EXPLAIN("Request for nonexistent InputMap action: " + String(p_action)); - ERR_FAIL_V(false); - } + ERR_FAIL_COND_V_MSG(!E, false, "Request for nonexistent InputMap action: " + String(p_action) + "."); Ref<InputEventAction> input_event_action = p_event; if (input_event_action.is_valid()) { if (p_pressed != NULL) *p_pressed = input_event_action->is_pressed(); if (p_strength != NULL) - *p_strength = (*p_pressed) ? input_event_action->get_strength() : 0.0f; + *p_strength = (p_pressed != NULL && *p_pressed) ? input_event_action->get_strength() : 0.0f; return input_event_action->get_action() == p_action; } |