Prevent ArgumentOutOfRangeException for emtpy files