Merge pull request #42 from JalfResi/bugfix/rss-node-missing-version

Added check to ensure that period is found in version string of RSS node
This commit is contained in:
Jim Teeuwen 2014-09-28 15:43:39 +02:00
commit 4edaff2441
1 changed files with 6 additions and 2 deletions

View File

@ -285,10 +285,14 @@ func (this *Feed) GetVersionInfo(doc *xmlx.Document) (ftype string, fversion [2]
rss: rss:
if node = doc.SelectNode("", "rss"); node != nil { if node = doc.SelectNode("", "rss"); node != nil {
ftype = "rss" ftype = "rss"
major := 0
minor := 0
version := node.As("", "version") version := node.As("", "version")
p := strings.Index(version, ".") p := strings.Index(version, ".")
major, _ := strconv.Atoi(version[0:p]) if p != -1 {
minor, _ := strconv.Atoi(version[p+1 : len(version)]) major, _ = strconv.Atoi(version[0:p])
minor, _ = strconv.Atoi(version[p+1 : len(version)])
}
fversion = [2]int{major, minor} fversion = [2]int{major, minor}
return return
} }