Fixed a null pointer exception when checking for key handlers.