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:
|
// Returns a string representing the channel modes. Looks like:
|
||||||
// +npk key
|
// +npk key
|
||||||
func (cm *ChanMode) String() string {
|
func (cm *ChanMode) String() string {
|
||||||
|
if cm == nil {
|
||||||
|
return "No modes set"
|
||||||
|
}
|
||||||
str := "+"
|
str := "+"
|
||||||
a := make([]string, 0)
|
a := make([]string, 0)
|
||||||
v := reflect.Indirect(reflect.ValueOf(cm))
|
v := reflect.Indirect(reflect.ValueOf(cm))
|
||||||
|
@ -335,6 +338,9 @@ func (cm *ChanMode) String() string {
|
||||||
// Returns a string representing the channel privileges. Looks like:
|
// Returns a string representing the channel privileges. Looks like:
|
||||||
// +o
|
// +o
|
||||||
func (cp *ChanPrivs) String() string {
|
func (cp *ChanPrivs) String() string {
|
||||||
|
if cp == nil {
|
||||||
|
return "No modes set"
|
||||||
|
}
|
||||||
str := "+"
|
str := "+"
|
||||||
v := reflect.Indirect(reflect.ValueOf(cp))
|
v := reflect.Indirect(reflect.ValueOf(cp))
|
||||||
t := v.Type()
|
t := v.Type()
|
||||||
|
|
|
@ -183,6 +183,9 @@ func (nk *nick) String() string {
|
||||||
// Returns a string representing the nick modes. Looks like:
|
// Returns a string representing the nick modes. Looks like:
|
||||||
// +iwx
|
// +iwx
|
||||||
func (nm *NickMode) String() string {
|
func (nm *NickMode) String() string {
|
||||||
|
if nm == nil {
|
||||||
|
return "No modes set"
|
||||||
|
}
|
||||||
str := "+"
|
str := "+"
|
||||||
v := reflect.Indirect(reflect.ValueOf(nm))
|
v := reflect.Indirect(reflect.ValueOf(nm))
|
||||||
t := v.Type()
|
t := v.Type()
|
||||||
|
|
Loading…
Reference in New Issue