diff options
author | Ethan Koenig <etk39@cornell.edu> | 2016-12-22 03:58:04 -0500 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2016-12-22 16:58:04 +0800 |
commit | 4c89a9c33c4c097836f5bfa79cc7e5adc142a2f0 (patch) | |
tree | a09bfe9d886ebcd5145a17d15c945b0b14e2bc53 /models/issue.go | |
parent | df7fa4e9959ab23fd94c3475d0860af810936e88 (diff) | |
download | gitea-4c89a9c33c4c097836f5bfa79cc7e5adc142a2f0.tar.gz gitea-4c89a9c33c4c097836f5bfa79cc7e5adc142a2f0.zip |
Bug fixes and tests for modules/base (#442)
Also address other TODOs
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 14 |
1 files changed, 9 insertions, 5 deletions
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) } } |