diff --git a/modules/stonehenge/api_story.go b/modules/stonehenge/api_story.go index b0c6dd36a..d3422de38 100644 --- a/modules/stonehenge/api_story.go +++ b/modules/stonehenge/api_story.go @@ -71,7 +71,7 @@ func (this *apiComp) Story(session comm.IUserSession, req *pb.StonehengeStoryReq } return } - this.module.Debugf("%v", conf) + this.module.Debugf("GetStoneStoryConf:%v", conf) if req.Pos == 0 { event = conf.OptionEventIdGroup1 } else if req.Pos == 1 { @@ -109,14 +109,18 @@ func (this *apiComp) Story(session comm.IUserSession, req *pb.StonehengeStoryReq szW = append(szW, int32(n)) } } - - arr := strings.Split(event[comm.GetRandW(szW)], ",") - if n, err := strconv.Atoi(arr[2]); err == nil { - stone.Rooms.Story = int32(n) - } - if n, err := strconv.Atoi(arr[0]); err == nil { - newEvent = int32(n) - stone.Rooms.Eventid[newEvent] = false + if len(event) > 0 { + arr := strings.Split(event[comm.GetRandW(szW)], ",") + if len(arr) != 3 { + return + } + if n, err := strconv.Atoi(arr[2]); err == nil { + stone.Rooms.Story = int32(n) + } + if n, err := strconv.Atoi(arr[0]); err == nil { + newEvent = int32(n) + stone.Rooms.Eventid[newEvent] = false + } } } }