forked from forgejo/forgejo
[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
This commit is contained in:
parent
13bc82009c
commit
8d43563a32
3 changed files with 53 additions and 29 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue