added a check to ensure the returned key name is non-null and exists in the localStorage before attempting to decrypt it