diff options
Diffstat (limited to 'models/user/user.go')
-rw-r--r-- | models/user/user.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go index 80ddcdba37..d56a225d5f 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -160,6 +160,12 @@ type SearchOrganizationsOptions struct { // ColorFormat writes a colored string to identify this struct func (u *User) ColorFormat(s fmt.State) { + if u == nil { + log.ColorFprintf(s, "%d:%s", + log.NewColoredIDValue(0), + log.NewColoredValue("<nil>")) + return + } log.ColorFprintf(s, "%d:%s", log.NewColoredIDValue(u.ID), log.NewColoredValue(u.Name)) |