fix(player): 修复怪物生成时PitS为空导致的崩溃问题 当玩家切换地图时,PitS可能为nil,此时访问会导致程序崩溃。 添加空值检查以避免此问题。 ```
This commit is contained in:
@@ -51,6 +51,9 @@ func (p *Player) GenMonster() {
|
||||
p.Data[oldnum] = OgrePetInfo{} //切地图清空
|
||||
|
||||
for _, i := range replce {
|
||||
if p.GetSpace().PitS == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
ogreconfig, ok := p.GetSpace().PitS.Load(i) //service.NewMapPitService().GetData(p.Info.MapID, uint32(i))
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user