diff options
author | Unknwon <u@gogs.io> | 2017-03-13 02:41:04 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-13 02:41:04 -0400 |
commit | e6df2259abdeb75545f53a5ca4c247491b5c3d7f (patch) | |
tree | c3a1cfba62c9e976c5bc272ef96e09d9c5174a7e /routers/home.go | |
parent | 96ae0129ef4db2bb5c7fc3bdcbc128700f116ac1 (diff) |
explore: panic if search without login (#3088)
Diffstat (limited to 'routers/home.go')
-rw-r--r-- | routers/home.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/home.go b/routers/home.go index 63a56490..3c1aa6d5 100644 --- a/routers/home.go +++ b/routers/home.go @@ -75,9 +75,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { } count = opts.Counter(opts.Private) } else { + var ctxUserID int64 + if ctx.IsSigned { + ctxUserID = ctx.User.ID + } repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{ Keyword: keyword, - UserID: ctx.User.ID, + UserID: ctxUserID, OrderBy: opts.OrderBy, Private: opts.Private, Page: page, |