Browse Source

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

Unknwon 8 years ago
parent
commit
bab448681d
3 changed files with 5 additions and 2 deletions
  1. 1 1
      gogs.go
  2. 3 0
      models/user.go
  3. 1 1
      templates/.VERSION

+ 1 - 1
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

+ 3 - 0
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 {

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.10.9.0308
+0.10.10.0308