Godot version:
3.2.1
OS/device including version:
ubuntu 19.10
Issue description:
On the _input(event) func if the user checks for button_index (which is a mouse button) but if the player has pressed a key it generates an error.
Ps: This is working right, but if the user presses a key, not a mouse button button index should return at least -1 and not generate a error.
Steps to reproduce:
func _input(event):
if (event.is_pressed() and event.button_index == BUTTON_RIGHT):
print("pressed")
pass
*Run the game
*press delete key
*should happen something like this:

** There is a workaround?
Checking if event.button_index != null will return a error too so the workaround was:
if event is InputEventMouseButton above the code mentioned.
Minimal reproduction project:
N/A
Hi,
It makes sense from my underdstanding.
The "event" parameter in _input is an object of the class InputEvent, or any of the classes that inherit it. Those cover mouse, keyboard, midi input ...
button_index is a property of InputEventMouseButton. And not at all related to keyboard input (InputEventKey)
So it's up to you to check which type of event you are expecting with if event is InputEventMouseButton, or if event is InputEventMouseMotion ...
Most helpful comment
Hi,
It makes sense from my underdstanding.
The "event" parameter in _input is an object of the class InputEvent, or any of the classes that inherit it. Those cover mouse, keyboard, midi input ...
button_index is a property of InputEventMouseButton. And not at all related to keyboard input (InputEventKey)
So it's up to you to check which type of event you are expecting with
if event is InputEventMouseButton, orif event is InputEventMouseMotion...