diff options
author | Oleg Kovalov <iamolegkovalov@gmail.com> | 2018-10-20 23:25:14 +0200 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-10-20 17:25:14 -0400 |
commit | 5a4648cdd697be92d33be55cd85069365cce2588 (patch) | |
tree | 0d246271e482d8d8ffb9f357861c0db5d698064f /models | |
parent | 583b1b84293635633199123ff759849fbd09f7f2 (diff) | |
download | gitea-5a4648cdd697be92d33be55cd85069365cce2588.tar.gz gitea-5a4648cdd697be92d33be55cd85069365cce2588.zip |
Remove check for negative length (#5120)
Diffstat (limited to 'models')
-rw-r--r-- | models/issue_label.go | 2 | ||||
-rw-r--r-- | models/org.go | 4 | ||||
-rw-r--r-- | models/ssh_key.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index ab6c4731ee..bf61fcaeca 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -134,7 +134,7 @@ func NewLabels(labels ...*Label) error { // If pass repoID as 0, then ORM will ignore limitation of repository // and can return arbitrary label with any valid ID. func getLabelInRepoByName(e Engine, repoID int64, labelName string) (*Label, error) { - if len(labelName) <= 0 { + if len(labelName) == 0 { return nil, ErrLabelNotExist{0, repoID} } diff --git a/models/org.go b/models/org.go index 1cc25231e6..c0a4172dc5 100644 --- a/models/org.go +++ b/models/org.go @@ -677,7 +677,7 @@ func (env *accessibleReposEnv) Repos(page, pageSize int) ([]*Repository, error) } repos := make([]*Repository, 0, len(repoIDs)) - if len(repoIDs) <= 0 { + if len(repoIDs) == 0 { return repos, nil } @@ -705,7 +705,7 @@ func (env *accessibleReposEnv) MirrorRepos() ([]*Repository, error) { } repos := make([]*Repository, 0, len(repoIDs)) - if len(repoIDs) <= 0 { + if len(repoIDs) == 0 { return repos, nil } diff --git a/models/ssh_key.go b/models/ssh_key.go index c2836e6885..2592209b4d 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -376,7 +376,7 @@ func calcFingerprint(publicKeyContent string) (string, error) { } func addKey(e Engine, key *PublicKey) (err error) { - if len(key.Fingerprint) <= 0 { + if len(key.Fingerprint) == 0 { key.Fingerprint, err = calcFingerprint(key.Content) if err != nil { return err |