mirror of https://github.com/fluffle/goirc
Fix panic when String is called on nil mode pointers. Fixes #98.
This commit is contained in:
parent
47162eb0b8
commit
08c1bcf174
|
@ -299,6 +299,9 @@ func (ch *channel) String() string {
|
|||
// Returns a string representing the channel modes. Looks like:
|
||||
// +npk key
|
||||
func (cm *ChanMode) String() string {
|
||||
if cm == nil {
|
||||
return "No modes set"
|
||||
}
|
||||
str := "+"
|
||||
a := make([]string, 0)
|
||||
v := reflect.Indirect(reflect.ValueOf(cm))
|
||||
|
@ -335,6 +338,9 @@ func (cm *ChanMode) String() string {
|
|||
// Returns a string representing the channel privileges. Looks like:
|
||||
// +o
|
||||
func (cp *ChanPrivs) String() string {
|
||||
if cp == nil {
|
||||
return "No modes set"
|
||||
}
|
||||
str := "+"
|
||||
v := reflect.Indirect(reflect.ValueOf(cp))
|
||||
t := v.Type()
|
||||
|
|
|
@ -183,6 +183,9 @@ func (nk *nick) String() string {
|
|||
// Returns a string representing the nick modes. Looks like:
|
||||
// +iwx
|
||||
func (nm *NickMode) String() string {
|
||||
if nm == nil {
|
||||
return "No modes set"
|
||||
}
|
||||
str := "+"
|
||||
v := reflect.Indirect(reflect.ValueOf(nm))
|
||||
t := v.Type()
|
||||
|
|
Loading…
Reference in New Issue