I get a runtime error for an invalid memory address.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x4e0f24] goroutine 1192592 [running]: panic(0x793540, 0xc420010040)
channel.go is as follows:
35 func (m *Channel) Attributes() (*ChannelAttrs, error) { 36 redisHash := "sd:channels:" + m.hash 37 38 rc := m.ctx.RedisPool.Get() 39 values, err := redis.Values(rc.Do("HGETALL", redisHash)) 40 rc.Close() 41 if err != nil { 42 return nil, err 43 } 44 attrs := ChannelAttrs{} 45 redis.ScanStruct(values, &attrs) 46 return &attrs, nil 47 }
How is it possible that line 36 causes this? Is it possible that m
will be zero? If so, how?
Note: a hash is defined as a string.
source share