From 4c89a9c33c4c097836f5bfa79cc7e5adc142a2f0 Mon Sep 17 00:00:00 2001 From: Ethan Koenig Date: Thu, 22 Dec 2016 03:58:04 -0500 Subject: Bug fixes and tests for modules/base (#442) Also address other TODOs --- models/issue.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'models/issue.go') diff --git a/models/issue.go b/models/issue.go index 8d8c304666..0e6c794055 100644 --- a/models/issue.go +++ b/models/issue.go @@ -915,7 +915,10 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) { } if len(opts.Labels) > 0 && opts.Labels != "0" { - labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ",")) + labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ",")) + if err != nil { + return nil, err + } if len(labelIDs) > 0 { sess. Join("INNER", "issue_label", "issue.id = issue_label.issue_id"). @@ -1171,10 +1174,11 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats { And("is_pull = ?", opts.IsPull) if len(opts.Labels) > 0 && opts.Labels != "0" { - labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ",")) - if len(labelIDs) > 0 { - sess. - Join("INNER", "issue_label", "issue.id = issue_id"). + labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ",")) + if err != nil { + log.Warn("Malformed Labels argument: %s", opts.Labels) + } else if len(labelIDs) > 0 { + sess.Join("INNER", "issue_label", "issue.id = issue_id"). In("label_id", labelIDs) } } -- cgit v1.2.3