From 881b8948d4df35d3ecbb7168206c28a9b0d1ae2e Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 24 Dec 2017 12:22:56 -0600 Subject: [PATCH] lint: check error for decoder --- app/migrator/disqus.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/migrator/disqus.go b/app/migrator/disqus.go index 98894e80..9f3fba73 100644 --- a/app/migrator/disqus.go +++ b/app/migrator/disqus.go @@ -105,12 +105,15 @@ func (d *Disqus) convert(r io.Reader, siteID string) (ch chan store.Comment) { case xml.StartElement: if se.Name.Local == "thread" { thread := disqusThread{} - decoder.DecodeElement(&thread, &se) - postsMap[thread.UID] = thread.Link + if err := decoder.DecodeElement(&thread, &se); err == nil { + postsMap[thread.UID] = thread.Link + } } if se.Name.Local == "post" { comment := disqusComment{} - decoder.DecodeElement(&comment, &se) + if err := decoder.DecodeElement(&comment, &se); err != nil { + continue + } c := store.Comment{ ID: comment.ID, Locator: store.Locator{URL: postsMap[comment.Tid.Val], SiteID: siteID},