models/user: handle case when user doesn't belong to any organization (#4258)

pull/4264/head
Unknwon 2017-03-08 22:21:31 -05:00
parent de2d3e3fd8
commit bab448681d
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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 {

View File

@ -1 +1 @@
0.10.9.0308
0.10.10.0308