Commit 92d7d6acf4944bfb856b9920ef7c6ca6c3632b01

Authored by zhouhaihai
1 parent f5e38251

加一些数据保护

src/actions/FriendAction.lua
@@ -316,11 +316,15 @@ function _M.handleApplyRpc(agent, data) @@ -316,11 +316,15 @@ function _M.handleApplyRpc(agent, data)
316 end 316 end
317 317
318 redisproxy:pipelining(function (red) 318 redisproxy:pipelining(function (red)
319 - red:ZREM(FRIEND_APPLY_KEY:format(roleId), table_unpack(needAdd))  
320 - red:HMSET(FRIEND_KEY:format(roleId), table_unpack(needAddMy))  
321 - for _, objectId in pairs(needAdd) do  
322 - red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId)  
323 - red:hsetnx(FRIEND_KEY:format(objectId), roleId, newTag)--告知对放有新好友 319 + if next(needAdd) then
  320 + red:ZREM(FRIEND_APPLY_KEY:format(roleId), table_unpack(needAdd))
  321 + for _, objectId in pairs(needAdd) do
  322 + red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId)
  323 + red:hsetnx(FRIEND_KEY:format(objectId), roleId, newTag)--告知对放有新好友
  324 + end
  325 + end
  326 + if next(needAddMy) then
  327 + red:HMSET(FRIEND_KEY:format(roleId), table_unpack(needAddMy))
324 end 328 end
325 end) 329 end)
326 local myInfo = role:friendSInfo() 330 local myInfo = role:friendSInfo()
@@ -1048,8 +1048,13 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) @@ -1048,8 +1048,13 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1048 local count = effect[3] or 1 1048 local count = effect[3] or 1
1049 local reward = {} 1049 local reward = {}
1050 for i = 1, count do 1050 for i = 1, count do
1051 - local item = csvdb["event_dropCsv"][effect[2]]["range"]:randWeight(true)  
1052 - reward[item[1]] = (reward[item[1]] or 0) + item[2] 1051 + local dropData = csvdb["event_dropCsv"][effect[2]]
  1052 + if dropData then
  1053 + local item = dropData["range"]:randWeight(true)
  1054 + reward[item[1]] = (reward[item[1]] or 0) + item[2]
  1055 + else
  1056 + skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id))
  1057 + end
1053 end 1058 end
1054 self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId}) 1059 self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId})
1055 end, 1060 end,
src/adv/AdvBattle.lua
@@ -292,6 +292,7 @@ function Battle:battleBegin(roomId, blockId, params) @@ -292,6 +292,7 @@ function Battle:battleBegin(roomId, blockId, params)
292 local enemy = self:getEnemy(roomId, blockId) 292 local enemy = self:getEnemy(roomId, blockId)
293 if not enemy then return end 293 if not enemy then return end
294 local player = params.player 294 local player = params.player
  295 + if not player then return end
295 -- 玩家没死就是怪死了 296 -- 玩家没死就是怪死了
296 if player.hp > 0 then 297 if player.hp > 0 then
297 enemy:hurt(enemy.hp, self.player, {hurtType = 5}) 298 enemy:hurt(enemy.hp, self.player, {hurtType = 5})
src/adv/AdvBuff.lua
@@ -81,7 +81,9 @@ local function commonAttCond(_Buff, attrName) @@ -81,7 +81,9 @@ local function commonAttCond(_Buff, attrName)
81 effectCount = self.owner.battle.adv.level 81 effectCount = self.owner.battle.adv.level
82 elseif self.buffData.effectValue4 == 2 then 82 elseif self.buffData.effectValue4 == 2 then
83 local buff = self.owner.battle.player:getBuffById(tonumber(self.buffData.effectValue5)) 83 local buff = self.owner.battle.player:getBuffById(tonumber(self.buffData.effectValue5))
84 - effectCount = buff.layer 84 + if buff then
  85 + effectCount = buff.layer
  86 + end
85 end 87 end
86 return self.buffData.effectValue2 * effectCount 88 return self.buffData.effectValue2 * effectCount
87 end 89 end