summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-01-31 22:13:51 +0100
committerGitHub <noreply@github.com>2020-01-31 16:13:51 -0500
commit8d43563a320ded0ffc0b9d66020ed3451c187259 (patch)
tree323764c39e828d1d54e886fd24da035d89483056 /models
parent13bc82009c2def4e729f11340e74a14d6c6b32e8 (diff)
downloadgitea-8d43563a320ded0ffc0b9d66020ed3451c187259.tar.gz
gitea-8d43563a320ded0ffc0b9d66020ed3451c187259.zip
[BugFix] [API] Pull.API.Convert: Only try to get HeadBranch if HeadRepo exist (#10029)
* only try to get HeadBranch if HeadRepo exist * impruve * no nil error * add TEST * correct error msg
Diffstat (limited to 'models')
-rw-r--r--models/user.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index d10d2cbff8..ee66acf1a6 100644
--- a/models/user.go
+++ b/models/user.go
@@ -234,6 +234,9 @@ func (u *User) GetEmail() string {
// APIFormat converts a User to api.User
func (u *User) APIFormat() *api.User {
+ if u == nil {
+ return nil
+ }
return &api.User{
ID: u.ID,
UserName: u.Name,