From f0deac732d6e419eb002bba9bc63f90605d03d3d Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 30 Aug 2019 01:08:15 -0400 Subject: [PATCH] deal with fact split gives us empty strings --- honk.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/honk.go b/honk.go index 5f3acf3..4083da0 100644 --- a/honk.go +++ b/honk.go @@ -847,7 +847,9 @@ func getxonk(userid int64, xid string) *Honk { h.Date, _ = time.Parse(dbtimeformat, dt) h.Audience = strings.Split(aud, " ") h.Public = !keepitquiet(h.Audience) - h.Onts = strings.Split(onts, " ") + if len(onts) > 0 { + h.Onts = strings.Split(onts, " ") + } return h } @@ -866,7 +868,9 @@ func getbonk(userid int64, xid string) *Honk { h.Date, _ = time.Parse(dbtimeformat, dt) h.Audience = strings.Split(aud, " ") h.Public = !keepitquiet(h.Audience) - h.Onts = strings.Split(onts, " ") + if len(onts) > 0 { + h.Onts = strings.Split(onts, " ") + } return h } @@ -940,7 +944,9 @@ func getsomehonks(rows *sql.Rows, err error) []*Honk { h.Date, _ = time.Parse(dbtimeformat, dt) h.Audience = strings.Split(aud, " ") h.Public = !keepitquiet(h.Audience) - h.Onts = strings.Split(onts, " ") + if len(onts) > 0 { + h.Onts = strings.Split(onts, " ") + } honks = append(honks, &h) } rows.Close()