mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix: nil pointer panic on guild event flow decoder
This commit is contained in:
parent
c0713ba75d
commit
96fd4d32e7
@ -133,6 +133,15 @@ func (c *QQClient) processGuildEventBody(m *channel.ChannelMsgContent, eventBody
|
|||||||
updateChanLock.Lock()
|
updateChanLock.Lock()
|
||||||
defer updateChanLock.Unlock()
|
defer updateChanLock.Unlock()
|
||||||
oldInfo := guild.FindChannel(eventBody.ChangeChanInfo.GetChanId())
|
oldInfo := guild.FindChannel(eventBody.ChangeChanInfo.GetChanId())
|
||||||
|
if oldInfo == nil {
|
||||||
|
info, err := c.GuildService.FetchChannelInfo(m.Head.RoutingHead.GetGuildId(), eventBody.ChangeChanInfo.GetChanId())
|
||||||
|
if err != nil {
|
||||||
|
c.Error("error to decode channel info updated event: fetch channel info failed: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guild.Channels = append(guild.Channels, info)
|
||||||
|
oldInfo = info
|
||||||
|
}
|
||||||
if time.Now().Unix()-oldInfo.fetchTime <= 2 {
|
if time.Now().Unix()-oldInfo.fetchTime <= 2 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user