From f6655fbe11a047aecf341a060211e665a81003f5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 30 Mar 2022 14:15:12 +0200 Subject: [PATCH] Allow nil network in Get{Nick,Username,Realname} Will simplify callers. --- db.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db.go b/db.go index 6dcab77..1bb1576 100644 --- a/db.go +++ b/db.go @@ -116,21 +116,21 @@ func (net *Network) URL() (*url.URL, error) { } func GetNick(user *User, net *Network) string { - if net.Nick != "" { + if net != nil && net.Nick != "" { return net.Nick } return user.Username } func GetUsername(user *User, net *Network) string { - if net.Username != "" { + if net != nil && net.Username != "" { return net.Username } return GetNick(user, net) } func GetRealname(user *User, net *Network) string { - if net.Realname != "" { + if net != nil && net.Realname != "" { return net.Realname } if user.Realname != "" {