Check for localStorage before attempting clear