Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Album.GetReleaseDate() exception #7

Open
GoogleCodeExporter opened this issue Feb 7, 2016 · 0 comments
Open

Album.GetReleaseDate() exception #7

GoogleCodeExporter opened this issue Feb 7, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Release date can be empty in xml string. DateTime.parse throws an 
exception.

Possible fix (check for empty value, return Nullable DateTime)

        /// <summary>
        /// Returns the album's release date.
        /// </summary>
        /// <returns>
        /// A <see cref="DateTime"/>
        /// </returns>
        public DateTime? GetReleaseDate()
        {
            XmlDocument doc = request("album.getInfo");
          string releaseDate = extract(doc, "releasedate");
      if (!string.IsNullOrEmpty(releaseDate))
            return DateTime.Parse(releaseDate);

          return null;
        }

Maybe even do a DateTime.TryParse


Original issue reported on code.google.com by mkrijten...@gmail.com on 28 Apr 2010 at 8:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant