mirror of https://github.com/fluffle/goirc
Adding `Value.IsValid()` check in `NickMode.String()`. Fixes #98
This commit is contained in:
parent
64ad58533d
commit
a3cd605787
|
@ -144,7 +144,9 @@ func (nk *Nick) Equals(other *Nick) bool {
|
|||
|
||||
// Duplicates a NickMode struct.
|
||||
func (nm *NickMode) Copy() *NickMode {
|
||||
if nm == nil { return nil }
|
||||
if nm == nil {
|
||||
return nil
|
||||
}
|
||||
n := *nm
|
||||
return &n
|
||||
}
|
||||
|
@ -183,6 +185,7 @@ func (nk *nick) String() string {
|
|||
func (nm *NickMode) String() string {
|
||||
str := "+"
|
||||
v := reflect.Indirect(reflect.ValueOf(nm))
|
||||
if v.IsValid() {
|
||||
t := v.Type()
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
switch f := v.Field(i); f.Kind() {
|
||||
|
@ -196,5 +199,6 @@ func (nm *NickMode) String() string {
|
|||
if str == "+" {
|
||||
str = "No modes set"
|
||||
}
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue