Fix crash due to use of inactive def_handler()

Thanks to filterfalse.
Extract engine/keys:has_def_handler()

Checks that default handler exists for active mode.

For readability and less duplication.
Reset input_stat pointers to NULL in modes/cmdline
Merge branch 'fix-use-of-freed-memory'

Fix crash due to use of inactive def_handler()

Thanks to filterfalse.