input: fix accidental NULL pointer dereference

This could happen if the input queue was full, and an unmapped key was
used, or something like this.

Possibly fixes github issue #224.