Only add data when there is data to add also avoid clobbering existing data with empty file fixes #45843 * remove redundant code, update comments * fix mock dataloader, original does not return None * added test