summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-03-03 19:10:46 +0800
committerGitHub <noreply@github.com>2017-03-03 19:10:46 +0800
commitc1d5983d3ea74dbee55e14bfb0b2d91d9cf702e7 (patch)
tree2ec9861a76a2c107fb0775d22e3a84bde4f039a9 /routers
parentd2165a589004224a2b4db4091c06b149a68199fe (diff)
downloadgitea-c1d5983d3ea74dbee55e14bfb0b2d91d9cf702e7.tar.gz
gitea-c1d5983d3ea74dbee55e14bfb0b2d91d9cf702e7.zip
fix panic when get user repos from api (#1110)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/user/repo.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index d80e3a9baf..8b7ee92c62 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -25,8 +25,8 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
apiRepos[i] = ownRepos[i].APIFormat(models.AccessModeOwner)
}
// Set repositories user has access to.
- for i := len(ownRepos); i < len(apiRepos); i++ {
- apiRepos[i] = accessibleRepos[i]
+ for i := 0; i < len(accessibleRepos); i++ {
+ apiRepos[i+len(ownRepos)] = accessibleRepos[i]
}
ctx.JSON(200, &apiRepos)
}