Issue with using $currentTrigger when it is null

$currentTrigger was being used when it could be null, added check for truthiness (should guard against null use) before use in the 'key' handler.