Browse Source

explore: panic if search without login (#3088)

pull/3422/merge
Unknwon 8 years ago
parent
commit
e6df2259ab
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 6
      routers/home.go

6
routers/home.go

@ -75,9 +75,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
} }
count = opts.Counter(opts.Private) count = opts.Counter(opts.Private)
} else { } else {
var ctxUserID int64
if ctx.IsSigned {
ctxUserID = ctx.User.ID
}
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{ repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
Keyword: keyword, Keyword: keyword,
UserID: ctx.User.ID, UserID: ctxUserID,
OrderBy: opts.OrderBy, OrderBy: opts.OrderBy,
Private: opts.Private, Private: opts.Private,
Page: page, Page: page,

Loading…
Cancel
Save