Simplify string to int conversion where possible

This commit is contained in:
Howl
2016-06-13 21:48:09 +02:00
parent 2f027ce853
commit 32738aaae0
5 changed files with 20 additions and 25 deletions

View File

@@ -73,10 +73,8 @@ func badgesToArray(badges string) []int {
badgesSl := strings.Split(badges, ",")
for _, badge := range badgesSl {
if badge != "" && badge != "0" {
// We are ignoring errors because who really gives a shit if something's gone wrong on our end in this
// particular thing, we can just silently ignore this.
nb, err := strconv.Atoi(badge)
if err == nil && nb != 0 {
nb := common.Int(badge)
if nb != 0 {
end = append(end, nb)
}
}