diff options
author | Unknwon <u@gogs.io> | 2017-03-08 22:21:31 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-08 22:21:31 -0500 |
commit | bab448681d613e3982c46c7bd9ed54319638a3dd (patch) | |
tree | 179063d8ab1486ebb50dac9e4168f8155f47f350 | |
parent | de2d3e3fd8d8e0ecbf420b94d58cc3e78af2aa72 (diff) |
models/user: handle case when user doesn't belong to any organization (#4258)
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/user.go | 3 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
3 files changed, 5 insertions, 2 deletions
@@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.10.9.0308" +const APP_VER = "0.10.10.0308" func init() { setting.AppVer = APP_VER diff --git a/models/user.go b/models/user.go index 4ef4365a..75262917 100644 --- a/models/user.go +++ b/models/user.go @@ -453,6 +453,9 @@ func (u *User) GetOrganizations(showPrivate bool) error { if err != nil { return fmt.Errorf("GetOrgIDsByUserID: %v", err) } + if len(orgIDs) == 0 { + return nil + } u.Orgs = make([]*User, 0, len(orgIDs)) if err = x.In("id", orgIDs).Find(&u.Orgs); err != nil { diff --git a/templates/.VERSION b/templates/.VERSION index 8c94423e..4f3c089e 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.10.9.0308
\ No newline at end of file +0.10.10.0308
\ No newline at end of file |