Check for key before accessing it