From bab448681d613e3982c46c7bd9ed54319638a3dd Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 8 Mar 2017 22:21:31 -0500 Subject: [PATCH] models/user: handle case when user doesn't belong to any organization (#4258) --- gogs.go | 2 +- models/user.go | 3 +++ templates/.VERSION | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gogs.go b/gogs.go index 633776b65..e1f39a065 100644 --- a/gogs.go +++ b/gogs.go @@ -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 4ef4365a6..752629172 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 8c94423ed..4f3c089e8 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